Commit bbb93f38 authored by luke.bullas's avatar luke.bullas

Zoo Project

parents
import java.util.ArrayList;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
//This list of arrays archive species of animals which area; Birds, Fish, Mammals and Reptiles
Boolean isConditionTrue = true;
//Bird Array
ArrayList < String > Birds = new ArrayList<String>();
Birds.add("Crane");
Birds.add("Dipper");
Birds.add("Fulmar");
Birds.add("Firecrest");
//Fish Array
ArrayList < String > Fish = new ArrayList<String>();
Fish.add("GoldFish");
Fish.add("BlobFish");
Fish.add("SwordFish");
Fish.add("BlueTang");
//Mammals Array
ArrayList < String > Mammals = new ArrayList<String>();
Mammals.add("Polar Bears");
Mammals.add("Seals");
Mammals.add("Camels");
//Reptiles Array
ArrayList < String > Reptiles = new ArrayList<String>();
Reptiles.add("Tortoise");
Reptiles.add("RattleSnake");
Reptiles.add("Aligator");
//This while statement will continue to loop the program untill the Boolean is changed to false.
while (isConditionTrue = true) {
//This piece of code Shows what Species there is, and will then take the users input for the next piece of code
System.out.println("What animal would you like to see?");
System.out.println("");
System.out.println("Birds");
System.out.println("");
System.out.println("Fish");
System.out.println("");
System.out.println("Mammals");
System.out.println("");
System.out.println("Reptiles");
System.out.println("");
Scanner scanner = new Scanner(System.in);
String Species = scanner.next();
// this code will change the input from the user to all capital letters
Species.toUpperCase();
//This case statement will display in the console what animals they want to see, and will then let the user pick which one they want to see.
switch (Species) {
case "birds":
if (Species.contains("birds")) {
System.out.println("");
System.out.println(Birds);
BirdMethod();
}
break;
case "fish":
if (Species.contains("fish")) {
System.out.println("");
System.out.println(Fish);
FishMethod();
}
break;
case "mammals":
if (Species.contains("mammals")) {
System.out.println("");
System.out.println(Mammals);
MammalMethod();
}
break;
case "reptiles":
if (Species.contains("reptiles")) {
System.out.println("");
System.out.println(Reptiles);
ReptileMethod();
}
break;
default:
System.out.println("please re-enter one of the areas");
}
}
}
public static void BirdMethod() {
//once it has gone through the first Case it will then be sent into another one for the users next input.
//This input will be the users Specific animal they would like to see
System.out.println("");
System.out.println("Now what specific Bird would you like to see?");
System.out.println("");
System.out.println("Enter 1 for: Crane");
System.out.println("");
System.out.println("Enter 2 for: Dipper");
System.out.println("");
System.out.println("Enter 3 for: Fulmar");
System.out.println("");
System.out.println("Enter 4 for: FireCrest");
System.out.println("");
Scanner sc = new Scanner(System.in);
int Bird = sc.nextInt();
//Once the final response has gone through the case it will then loop back to the beginning of the code for the user to repeat
switch (Bird) {
case 1:
cranedes();
break;
case 2:
dipperdes();
break;
case 3:
fulmardes();
break;
case 4:
firecrestdes();
break;
default:
System.out.println("Please try again");
sc.close();
}
}
public static void FishMethod() {
System.out.println("");
System.out.println("What Specific Fish would you like to see?");
System.out.println("");
System.out.println("Enter 1 for: Gold Fish");
System.out.println("");
System.out.println("Enter 2 for: Blob Fish");
System.out.println("");
System.out.println("Enter 3 for: Sword Fish");
System.out.println("");
System.out.println("Enter 4 for: Blue Tang Fish");
Scanner sf = new Scanner(System.in);
int Fish = sf.nextInt();
switch (Fish) {
case 1:
goldfishdes();
break;
case 2:
blobfishdes();
break;
case 3:
swordfishdes();
break;
case 4:
bluetangdes();
break;
default:
System.out.println("Please try again");
sf.close();
}
}
public static void MammalMethod() {
System.out.println("");
System.out.println("What Specific Mammal would you like to see?");
System.out.println("");
System.out.println("Enter 1 for: Polar Bear");
System.out.println("");
System.out.println("Enter 2 for: Seal");
System.out.println("");
System.out.println("Enter 3 for: Cammel");
Scanner sm = new Scanner(System.in);
int Mammal = sm.nextInt();
switch (Mammal) {
case 1:
PolarBeardes();
break;
case 2:
SealsDes();
break;
case 3:
CammelsDes();
break;
default:
System.out.println("Please try again");
sm.close();
}
}
public static void ReptileMethod() {
System.out.println("");
System.out.println("What Specific Reptile would you like to see?");
System.out.println("");
System.out.println("Enter 1 for: Tortoise");
System.out.println("");
System.out.println("Enter 2 for: RattleSnake");
System.out.println("");
System.out.println("Enter 3 for: Alligator");
Scanner sr = new Scanner(System.in);
int Reptile = sr.nextInt();
switch (Reptile) {
case 1:
Tortoisedes();
break;
case 2:
RattleSnakedes();
break;
case 3:
AlligatorDes();
break;
default:
System.out.println("Please Try Again");
sr.close();
}
}
// Bird Information
public static void cranedes() {
System.out.println("");
System.out.println("Cranes eat Seeds, roots, insects, snails and worms, they weigh a total of 4-7kg and there wingspan is approximatly 220-245cm");
System.out.println("the amount of Cranes in Europe has declined over the last 300 years because of disturbance, shooting and drainage");
System.out.println("");
}
public static void dipperdes() {
System.out.println("");
System.out.println("Dippers eat insect larvae and freshwater shrimps, they weigh as little as 55-75g and there wingspan is approximatly 25-30cm");
System.out.println("When the dipper is perched on a rock it will bob up and down and frequently cock its tail");
System.out.println("");
}
public static void fulmardes() {
System.out.println("");
System.out.println("Fulmars are almost seaqul like birds, they weight a total of 610-1000g and there wingspan is approximatly 1-1.12m");
System.out.println("The Fulmar eat fish waste, crustaceans and sand eels");
System.out.println("");
}
public static void firecrestdes() {
System.out.println("");
System.out.println("Firecrest eat tiny morsels like spiders, moth eggs and other small insect food, they weigh 5-7g and there wingspan is approximatly 12-16cm");
System.out.println("The firecrest has a green back, white belly and bronze collar and a black and white eye-stripe");
System.out.println("");
}
//Fish Information
public static void goldfishdes() {
System.out.println("");
System.out.println("In the wild Goldfish are omnivores, eating aquatic vegetation, frogs, newts and fish eggs. Goldfish are one of the longest living fish with the oldest living goldfish reaching 49 years old");
System.out.println("");
}
public static void blobfishdes() {
System.out.println("");
System.out.println("Blobfish are born without a swin bladder, this internal air sac allows the fish to maneuver thorugh the water without sinking. some of the food that the blobfish eats are crabs and mollusks");
System.out.println("");
}
public static void swordfishdes() {
System.out.println("");
System.out.println("Swordfish can weigh a total of 1,182 pounds and can grow as large as 14 feet long. Swordfish are carnivores eating ocean fish such as bluefish, mackarel and hake");
System.out.println("");
}
public static void bluetangdes() {
System.out.println("");
System.out.println("Sometimes the bluetang isnt blue at all and can sometimes be yellow, blue tangs mostly eat plankton and when they are adults they also feed on algae.");
System.out.println("Blue Tangs are important for the reefs health as they eat the algea that could otherwise cover the coral");
System.out.println("");
}
//Mammals Information
public static void PolarBeardes() {
System.out.println("");
System.out.println("The polarbear is classed as a marine mammal, they can continuesly swim for days at a time, and there is a certain hybrid called Grizzly-polar bears that exists.");
System.out.println("");
}
public static void SealsDes() {
System.out.println("");
System.out.println("The seal is known to be related to Bears, skunks and badgers, the largest seal recorded weighs more then four tons");
System.out.println("");
}
public static void CammelsDes() {
System.out.println("");
System.out.println("Cammels have three sets of eyelids and two rows of eyelashes to keep sand out of there eyes, they also have thick lips which lets them forage for thorny plants other animals cant eat");
System.out.println("");
}
//Reptile Information
public static void Tortoisedes() {
System.out.println("");
System.out.println("Tortoises are ancient reptiles, they can live for a very long time and can also live pretty much anywhere in the world");
System.out.println("");
}
public static void RattleSnakedes() {
System.out.println("");
System.out.println("The rattlesnakes rattle helps them fend of from being eaten by there predators, the rattle is made from scales that form loose rings of hard dry skin");
System.out.println("");
}
public static void AlligatorDes() {
System.out.println("");
System.out.println("Alligators are toothy reptiles, they are also apex predators that can also eat fruit and they will continue to grow thoughout there lifetimes");
System.out.println("");
}
//What i was going to use to display all the animals food at once, but would not work and i have tried everything i can think off to get it to work
public static void allFood() {
System.out.println("Cranes eat Seeds, roots, insects, snails and worms,");
System.out.println("");
System.out.println("Dippers eat insect larvae and freshwater shrimps");
System.out.println("");
System.out.println("The Fulmar eat fish waste, crustaceans and sand eels");
System.out.println("");
System.out.println("Firecrest eat tiny morsels like spiders, moth eggs and other small insect food");
System.out.println("");
System.out.println("Goldfish are omnivores, eating aquatic vegetation, frogs, newts and fish eggs");
System.out.println("");
System.out.println("Blobfish eat seapens, crabs, mollusks and sea urchins");
System.out.println("");
System.out.println("Swordfish are carnivores eating ocean fish such as bluefish, mackarel and hake");
System.out.println("");
System.out.println("Bluetangs eat algea and plankton");
System.out.println("");
System.out.println("PolarBears mostly eat seals");
System.out.println("");
System.out.println("Cammels are herbivores, eating grass, grains, wheat and oats");
System.out.println("");
System.out.println("Tortoise's eat a variaty of plant based foods like berries, kiwi, melon and oranges");
System.out.println("");
System.out.println("like most snakes, rattlesnakes live on rodents and insects");
System.out.println("");
System.out.println("Alligators eat small fish and other invertebrates");
System.out.println("");
}
}
\ No newline at end of file
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