Re: Design question
Andrew Thompson wrote:
On Feb 13, 8:34 am, John <printdude1...@gmail.com> wrote:
Ed Kirwan wrote:
...
Animal
|
|---- Mammal
|
|
|-- Vertebrate
Besides mammals - marsupials, reptiles and
birds all have backbones, as do many fish.
It seems this inheritance structure has
the wrong order.
Andrew T.
Yes, I just realized that. The correct structure should be
My top level is Mammal
package mammals;
public class Mammals {
int numberOfLegs;
int numberOfStomachs;
String methodOfReproduction;
boolean canFly;
final String kingdom="Animalia";
final String phylum="Chordata";
final String subPhylum="Vertebrata";
final String akClass="Mammalia";
String akSubClass;
public String getAkSubClass() {
return akSubClass;
}
public void setAkSubClass(String akSubClass) {
this.akSubClass = akSubClass;
}
public boolean isCanFly() {
return canFly;
}
public void setCanFly(boolean canFly) {
this.canFly = canFly;
}
public String getMethodOfReproduction() {
return methodOfReproduction;
}
public void setMethodOfReproduction(String methodOfReproduction) {
this.methodOfReproduction = methodOfReproduction;
}
public int getNumberOfLegs() {
return numberOfLegs;
}
public void setNumberOfLegs(int numberOfLegs) {
this.numberOfLegs = numberOfLegs;
}
public int getNumberOfStomachs() {
return numberOfStomachs;
}
public void setNumberOfStomachs(int numberOfStomachs) {
this.numberOfStomachs = numberOfStomachs;
}
public Mammals(int numberOfLegs, int numberOfStomachs, String
methodOfReproduction, boolean canFly, String akSubClass) {
super();
this.numberOfLegs = numberOfLegs;
this.numberOfStomachs = numberOfStomachs;
this.methodOfReproduction = methodOfReproduction;
this.canFly = canFly;
this.akSubClass = akSubClass;
}
}