Commit 7b8d39ce authored by Jake's avatar Jake

First Commit

parents
public class Animals {
//declaring variables for animal objects
String animalName;
String animalFood;
String animalType;
String animalEnvironment;
String animalDescription;
//creating a constructor - allows us to write much tidier and easier to follow code
Animals(String animalName, String animalType, String animalFood, String animalEnvironment, String animalDescription) {
this.animalName = animalName;
this.animalType = animalType;
this.animalFood = animalFood;
this.animalEnvironment = animalEnvironment;
this.animalDescription = animalDescription;
}
@Override
public String toString() {
return "Animal Name: " + animalName + ", Diet: " + animalFood + ", Animal Type: " + animalType + ", Habitat: " + animalEnvironment + ", Description: " + animalDescription + "\n";
}
}
public class Bird extends Animals {
//creating a constructor - allows us to write much tidier and easier to follow code
Bird(String animalName, String animalType, String animalFood, String animalEnvironment, String animalDescription){
super(animalName, animalType, animalFood, animalEnvironment, animalDescription);
}
}
public class Fish extends Animals {
//creating a constructor - allows us to write much tidier and easier to follow code
Fish(String animalName, String animalType, String animalFood, String animalEnvironment, String animalDescription){
super(animalName, animalType, animalFood, animalEnvironment, animalDescription);
}
}
public class Mammal extends Animals {
//creating a constructor - allows us to write much tidier and easier to follow code
Mammal(String animalName, String animalType, String animalFood, String animalEnvironment, String animalDescription){
super(animalName, animalType, animalFood, animalEnvironment, animalDescription);
}
}
public class Reptile extends Animals {
//creating a constructor - allows us to write much tidier and easier to follow code
Reptile(String animalName, String animalType, String animalFood, String animalEnvironment, String animalDescription){
super(animalName, animalType, animalFood, animalEnvironment, animalDescription);
}
}
This diff is collapsed.
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