Commit c45990dc authored by harve's avatar harve

Final

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-12">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ZooProject</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>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=12
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=12
/animal.class
/zooMain.class
import java.util.ArrayList;
import java.util.Scanner;
class animal {
public String animalName;
public String animalType;
public String animalFood;
public String animalEnviroment;
public void food() {
System.out.print(this.animalFood);
}
public void type() {
System.out.print(this.animalType);
}
public void enviroment() {
System.out.print(this.animalEnviroment);
}
public String getFood() {
return this.animalFood;
}
public String getType() {
return this.animalType;
}
public String getEnviroment() {
return this.animalEnviroment;
}
public String getName() {
return this.animalName;
}
public animal(String animalNameInput, String animalTypeInput, String animalEnviromentInput, String animalFoodInput) {
this.animalName = animalNameInput;
this.animalEnviroment = animalEnviromentInput;
this.animalFood = animalFoodInput;
this.animalType = animalTypeInput;
}
}
public class zooMain {
static ArrayList<String> animalList = new ArrayList<String>();
static ArrayList<String> foodList = new ArrayList<String>();
static ArrayList<String> catsList = new ArrayList<String>();
static ArrayList<String> xList = new ArrayList<String>();
static ArrayList<String> fishList = new ArrayList<String>();
static ArrayList<String> birdList = new ArrayList<String>();
static ArrayList<String> animalFood = new ArrayList<String>();
static ArrayList<String> forestList = new ArrayList<String>();
static ArrayList<String> waterList = new ArrayList<String>();
static ArrayList<String> arcticList = new ArrayList<String>();
static ArrayList<String> heatList = new ArrayList<String>();
static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
animal Tiger = new animal("Tiger", "Cats", "Heat", "Meat");
animalList.add("Tiger");
animal Lion = new animal("Lion", "Cats", "Heat", "Meat");
animalList.add("Lion");
animal Giraffe = new animal("Giraffe", "X", "Heat", "Veg");
animalList.add("Giraffe");
animal Penguin = new animal("Penguin", "X", "Arctic", "Fish");
animalList.add("Penguin");
animal Zebra = new animal("Zebra", "X", "Heat", "Veg");
animalList.add("Zebra");
animal RainbowTrout = new animal("RainbowTrout", "Fish", "Water", "Fish");
animal Salmon = new animal("Salmon", "Fish", "Water", "Fish");
animal Pheasant = new animal("Pheasant", "Bird", "Forest", "Seed");
animal Pigeon = new animal("Pigeon", "Bird", "Forest", "Seed");
animalList.add("Salmon");
animalList.add("Pheasant");
animalList.add("Pigeon");
animalList.add("RainbowTrout");
catsList.add(Tiger.getName());
catsList.add(Lion.getName());
xList.add(Penguin.getName());
xList.add(Giraffe.getName());
xList.add(Zebra.getName());
fishList.add(RainbowTrout.getName());
fishList.add(Salmon.getName());
birdList.add(Pigeon.getName());
birdList.add(Pheasant.getName());
animalFood.add(Tiger.getFood());
animalFood.add(Lion.getFood());
animalFood.add(Giraffe.getFood());
animalFood.add(Penguin.getFood());
animalFood.add(Zebra.getFood());
animalFood.add(Salmon.getFood());
animalFood.add(RainbowTrout.getFood());
animalFood.add(Pheasant.getFood());
animalFood.add(Pigeon.getFood());
forestList.add(Pigeon.getName());
forestList.add(Pheasant.getName());
heatList.add(Zebra.getName());
heatList.add(Lion.getName());
heatList.add(Tiger.getName());
heatList.add(Giraffe.getName());
waterList.add(Salmon.getName());
waterList.add(RainbowTrout.getName());
arcticList.add(Penguin.getName());
while (true) {
System.out.println("Welcome to YSJ Zoo" + "\n"
+ "Please select an option: " + "\n"
+ "1 - Display all animals in zoo." + "\n"
+ "2 - Filter animals to type. " + "\n"
+ "3 - Display info on an animal. " + "\n"
+ "4 - Food required from all animals. " + "\n"
+ "5 - Display animals from a specific enviroment.");
int userInput = input.nextInt();
if (userInput == 1) {
System.out.println("These are all the animals in my zoo: " + animalList); }
else if (userInput == 2) {
System.out.println("These are our animal types: (Cats/No Group(X)/Birds/Fish)");
System.out.println("Which type do you want to see? ");
String filterType = input.next();
switch(filterType) {
case "Cats":
System.out.println("These animals are members of the cats type: " + catsList);
return;
case "X":
System.out.println("These animals are members of the no group type: " + xList);
return;
case "Fish":
System.out.println("These animals are members of the fish type: " + fishList);
return;
case "Birds":
System.out.println("These animals are members of the bird type: " + birdList);
return;
}
} else if (userInput == 3) {
System.out.println("Which animal would you like more info on: " + animalList);
String animalChoice = input.next();
switch (animalChoice) {
case "Tiger":
System.out.println("Name: Tiger");
System.out.print("The food they eat: ");Tiger.food();System.out.print("\n");
System.out.print("Type of animal group: ");Tiger.type();System.out.print("\n");
System.out.print("They enviroment they live in: ");Tiger.enviroment();System.out.print("\n");
return;
case "Lion":
System.out.println("Name: Lion");
System.out.print("The food they eat: ");Lion.food();System.out.print("\n");
System.out.print("Type of animal group: ");Lion.type();System.out.print("\n");
System.out.print("They enviroment they live in: ");Lion.enviroment();System.out.print("\n");
return;
case "Giraffe":
System.out.println("Name: Giraffe");
System.out.print("The food they eat: ");Giraffe.food();System.out.print("\n");
System.out.print("Type of animal group: ");Giraffe.type();System.out.print("\n");
System.out.print("They enviroment they live in: ");Giraffe.enviroment();System.out.print("\n");
return;
case "Penguin":
System.out.println("Name: Penguin");
System.out.print("The food they eat: ");Penguin.food();System.out.print("\n");
System.out.print("Type of animal group: ");Penguin.type();System.out.print("\n");
System.out.print("They enviroment they live in: ");Penguin.enviroment();System.out.print("\n");
return;
case "Zebra":
System.out.println("Name: Zebra");
System.out.print("The food they eat: ");Zebra.food();System.out.print("\n");
System.out.print("Type of animal group: ");Zebra.type();System.out.print("\n");
System.out.print("They enviroment they live in: ");Zebra.enviroment();System.out.print("\n");
return;
}
} else if (userInput == 4) {
System.out.println("The food the aimals eat are as followed: " + animalFood);
} else if (userInput == 5) {
System.out.println("Which enviroment do you want to see the animals from?");
System.out.println("Heat/Water/Arctic/Forest");
String enviroChoice = input.next();
switch(enviroChoice) {
case "Heat":
System.out.println("The animals that live in a heated enviroment are: " + heatList);
return;
case "Water":
System.out.println("The animals that live in the water are: " + waterList);
return;
case "Arctic":
System.out.println("The only animal to live in the arctic area is: " + arcticList);
return;
case "Forest":
System.out.println("The animals that live in the forest are: " + forestList);
return;
}
}
}
}}
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