Commit 85742d3e authored by affankhan's avatar affankhan

Commit #1

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Virtual Zoo Affan Khan</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
public class Animals {
//establish the member variables
String name;
String scientificName;
String diet;
String habitat;
String physicalCharacteristics;
//create the constructor
Animals (String name, String scientificName, String diet, String habitat, String physicalCharacteristics) {
this.name = name;
this.scientificName = scientificName;
this.diet = diet;
this.habitat = habitat;
this.physicalCharacteristics = physicalCharacteristics;
}//end of the constructor
//create the print name method
void printName () {
System.out.println("Animal Name: " + name);
}//end of the print name method
//create the print details method
void printDetails () {
System.out.println("Animal Name: " + name);
System.out.println("Scientific Name: " + scientificName);
System.out.println("Diet: " + diet);
System.out.println("Habitat: " + habitat);
System.out.println("Physical Characteristics: " + physicalCharacteristics);
}//end of the print details method
//create the print habitat method
void printHabitat () {
System.out.println(name + "'s Habitat: " + habitat);
}//end of print habitat method
//create a method that prints the diet of the animal
void printDiet() {
//create the if statement for when the animal is a carnivore
if(diet == "Carnivores") {
System.out.println(name + "'s Diet: Meat");
}//end of the carnivore if statement
//create the if statement for when the animal is a herbivore
if(diet == "Herbivores") {
System.out.println(name + "'s Diet: Plants");
}//end of the herbivore if statement
//create the if statement for when the animal is a omnivore
if(diet == "Omnivores") {
System.out.println(name + "'s Diet: Meat and Plants");
}//end of the omnivore if statement
}
}
public class Birds extends Animals {
String birdFeature = "Have Feathers";
String birdFeature2 = "Lay Hard Shelled Eggs";
String birdFeature3 = "Toothless Beaked Jaws";
//create the constructor
Birds (String name, String scientificName, String diet, String habitat, String physicalCharacteristics) {
super(name, scientificName, diet, habitat, physicalCharacteristics);
}//end of the constructor
//create the print name method
void printName () {
super.printName();
}//end of print name method
//create the print details method
void printDetails () {
super.printDetails();
System.out.println("Features of Birds: " + birdFeature);
System.out.println(" " + birdFeature2);
System.out.println(" " + birdFeature3);
System.out.println("______________________________________________________________________________");
}//end of print details
//create the print habitat method
void printHabitat () {
super.printHabitat();
}//end of print habitat method
//create the print diet method
void printDiet () {
super.printDiet();
}//end of the print diet
}
public class Fish extends Animals {
//create the unique features variables
String fishFeature = "Use Gills to Breathe";
String fishFeature2 = "Use Fins for Movement";
String fishFeature3 = "Thrive in Water";
//create the constructor
Fish (String name, String scientificName, String diet, String habitat, String physicalCharacteristics) {
super(name, scientificName, diet, habitat, physicalCharacteristics);
}//end of the constructor
//create the print name method
void printName () {
super.printName();
}//end of print name method
//create the print details method
void printDetails () {
super.printDetails();
System.out.println("UniqueFeatures: " + fishFeature);
System.out.println(" " + fishFeature2);
System.out.println(" " + fishFeature3);
System.out.println("______________________________________________________________________________");
}//end of print details
//create the print habitat method
void printHabitat () {
super.printHabitat();
}//end of print habitat method
//create the print diet method
void printDiet () {
super.printDiet();
}//end of the print diet
}
This diff is collapsed.
public class Mammals extends Animals {
String mammalFeature = "Contain Mammary Glands";
String mammalFeature2 = "Female Produce Milk";
String mammalFeature3 = "Contain Fur or Hair";
//create the constructor
Mammals (String name, String scientificName, String diet, String habitat, String physicalCharacteristics) {
super(name, scientificName, diet, habitat, physicalCharacteristics);
}//end of the constructor
//create the print name method
void printName () {
super.printName();
}//end of print name method
//create the print details method
void printDetails () {
super.printDetails();
System.out.println("Features of Mammals: " + mammalFeature);
System.out.println(" " + mammalFeature2);
System.out.println(" " + mammalFeature3);
System.out.println("______________________________________________________________________________");
}//end of print details
//create the print habitat method
void printHabitat () {
super.printHabitat();
}//end of print habitat method
//create the print diet method
void printDiet () {
super.printDiet();
}//end of the print diet
}
public class Reptiles extends Animals {
//create the unique features variables
String reptileFeature = "Bodies are Covered in Scales";
String reptileFeature2 = "Ferilize Eggs Internally";
String reptileFeature3 = "Consist of Atleast One Lung";
//create the constructor
Reptiles (String name, String scientificName, String diet, String habitat, String physicalCharacteristics) {
super(name, scientificName, diet, habitat, physicalCharacteristics);
}//end of the constructor
//create the print name method
void printName () {
super.printName();
}//end of print name method
//create the print details method
void printDetails () {
super.printDetails();
System.out.println("UniqueFeatures: " + reptileFeature);
System.out.println(" " + reptileFeature2);
System.out.println(" " + reptileFeature3);
System.out.println("______________________________________________________________________________");
}//end of print details
//create the print habitat method
void printHabitat () {
super.printHabitat();
}//end of print habitat method
//create the print diet method
void printDiet () {
super.printDiet();
}//end of the print diet
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment