In: Computer Science
Create your two classes, named as above. The Parrot class must include:
You will then need to create an object (just make up some data), feed the parrot and print the parrot’s name and whether it has been fed. (hint: remember what you need to do in Main to accomplish this).
class Parrot{
private String pName;
private String pType;
private int age;
private boolean isAdopted;
public Parrot(String aPName, String aPType, int aAge, boolean aIsAdopted) {
super();
pName = aPName;
pType = aPType;
age = aAge;
isAdopted = aIsAdopted;
}
public String getpName() {
return pName;
}
public void setpName(String aPName) {
pName = aPName;
}
public void feed() {
System.out.println("Feeding Parrot");
}
public void bathe() {
System.out.println("Bathing Parrot");
}
}
public class ParrotDriver {
public static void main(String[] args) {
Parrot p = new Parrot("Jake", "LoveBird", 12, true);
p.feed();
System.out.println(p.getpName());
}
}