Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This are API\'s and should be typed in java language thanks. Identifier: Birdo P

ID: 3819933 • Letter: T

Question

This are API's and should be typed in java language thanks.

Identifier: Birdo Parameters Return Value Other A default constructor for the B class. Its behavior should ensure that all of ird the class fields (instance variables), including any inherited fields, are L erly initialized. Bird String name, int birthYear, Color featherColor) Identifier: Parameters name a String value indicated the bird's name. birth Year an int value indicating the bird's year of birth. featherColor a Color value indicating the color of the bird's feathers Return Value Other: An alternate constructor for the Bird class. It should ensure that all of the class fields (instance variables are initialized to the values of the given parameters Identifier: getFeatherColoro Parameters Return Value: Color Other: An Accessor method that returns the Color of a Bird's feathers String Identifier: to Parameters Return Value: String Other: An overridden method that will return a String which includes the Bird's name, it's year of birth, and the color of its feathers

Explanation / Answer

--------------------

Bird.java

import java.awt.Color;

public class Bird {
  
   String name;
   int birthYear;
   Color featherColor;
  
   public Bird() {
       this.name = "";
       this.birthYear = 0;
       this.featherColor = Color.white;
   }
  
   public Bird(String name, int birthYear, Color featherColor) {
       this.name = name;
       this.birthYear = birthYear;
       this.featherColor = featherColor;
   }
  
   public Color getFeatherColor() {
       return this.featherColor;
   }
  
   public String toString() {
       return name + " " + birthYear + " " + featherColor;
   }
}

--------------------

Parrot.java

import java.awt.Color;
import java.util.ArrayList;

public class Parrot extends Bird{
  
   ArrayList<String> words = new ArrayList<String>();
  
   public Parrot() {
       super("Polly", 2010, Color.green);
       words.add("name");
   }
  
   public void addWord(String word) {
       words.add(word);
   }
  
   public String listWordsKnown() {
       String word = "";
       for(int i=0; i<words.size(); i++) {
           word += (i == 0 ? "" : ";") + words.get(i);
       }
       return word;
   }
  
   public String toString() {
       return name + " " + birthYear + " " + featherColor + " " + this.listWordsKnown();
   }
}

--------------------

Crow.java

import java.awt.Color;
import java.util.ArrayList;

public class Crow extends Bird{
  
   ArrayList<Tool> tools = new ArrayList<Tool>();
  
   public Crow() {
       super("Jacob", 2008, Color.black);
       tools.add(new Tool("Chainshaw"));
   }
  
   public void addTool(Tool tool) {
       tools.add(tool);
   }
  
   public ArrayList<Tool> getToolsUsed() {
       return new ArrayList<>(tools);
   }
  
   public String toString() {
       String tool = "";
       for(int i=0; i<tools.size(); i++) {
           tool += (i == 0 ? "" : ";") + tools.get(i).toString();
       }
       return name + " " + birthYear + " " + featherColor + " " + tool;
   }
}

--------------------

Zoo.java

import java.util.ArrayList;

public class Zoo{
  
   ArrayList<Animal> animals;
  
   public Zoo() {
       animals = new ArrayList<Animal>()
   }
  
   public void addAnimal(Animal animal) {
       animals.add(animal);
   }
  
   public String listAnimals() {
       String animal = "";
       for(int i=0; i<animals.size(); i++) {
           animal += (i == 0 ? "" : ";") + animals.get(i).toString();
       }
       return animal;
   }
}

--------------------

Drawable Interface and class

DrawableInterface.java :

package Questions;

import java.awt.Graphics;

public interface DrawableInterface {
   public void draw(Drawable g);
}

DrawableClass.java

package Questions;

import java.awt.Graphics;

public class DrawableClass implements DrawableInterface{
   public void draw(Drawable g) {
   }
}

--------------------

Movable Interface and class

MovableInterface.java

package Questions;

import java.awt.Graphics;

public interface MovableInterface {
   public void move();
}

MovableClass.java

package Questions;

import java.awt.Graphics;

public class MovableClass implements MovableInterface{
   public void move() {
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote