Commit 2fe083e5 authored by elliot.copeland's avatar elliot.copeland

Excercise submission updated

parent 695b95a6
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -123,6 +123,15 @@ public class App { ...@@ -123,6 +123,15 @@ public class App {
System.out.println(""); System.out.println("");
Scanner inputScan = new Scanner(System.in); Scanner inputScan = new Scanner(System.in);
System.out.println(""); System.out.println("");
System.out.println("\n"
+ "\n [1] Add an Avian"
+ "\n [2] Add a Fish"
+ "\n [3] Add a Mammal"
+ "\n [4] Add a Reptile");
System.out.print("\n Please enter an option (1-4): ");
String inputClass = inputScan.nextLine();
System.out.print(" Enter the species: "); System.out.print(" Enter the species: ");
String inputSpecies = inputScan.nextLine(); String inputSpecies = inputScan.nextLine();
...@@ -135,15 +144,8 @@ public class App { ...@@ -135,15 +144,8 @@ public class App {
System.out.print(" Name the animal: "); System.out.print(" Name the animal: ");
String inputName = inputScan.nextLine(); String inputName = inputScan.nextLine();
System.out.println("\n"
+ "\n [1] Add an Avian"
+ "\n [2] Add a Fish"
+ "\n [3] Add a Mammal"
+ "\n [4] Add a Reptile");
System.out.print("\n Please enter an option (1-4): ");
String usrInput = inputScan.nextLine(); if (inputClass.equals("1")) {
if (usrInput.equals("1")) {
System.out.print(" Enter the Feather Colour: "); System.out.print(" Enter the Feather Colour: ");
String inputFColour = inputScan.nextLine(); String inputFColour = inputScan.nextLine();
...@@ -155,7 +157,7 @@ public class App { ...@@ -155,7 +157,7 @@ public class App {
animalList.add(anml); animalList.add(anml);
} }
else if (usrInput.equals("2")) { else if (inputClass.equals("2")) {
System.out.print(" Enter the Scale Colour: "); System.out.print(" Enter the Scale Colour: ");
String inputSCol = inputScan.nextLine(); String inputSCol = inputScan.nextLine();
...@@ -163,7 +165,7 @@ public class App { ...@@ -163,7 +165,7 @@ public class App {
Animal anml = new Fish(inputSpecies, inputHabitat, inputFood, inputName, inputSCol); Animal anml = new Fish(inputSpecies, inputHabitat, inputFood, inputName, inputSCol);
animalList.add(anml); animalList.add(anml);
} }
else if (usrInput.equals("3")) { else if (inputClass.equals("3")) {
System.out.print(" Enter the Fur Colour: "); System.out.print(" Enter the Fur Colour: ");
String inputFCol = inputScan.nextLine(); String inputFCol = inputScan.nextLine();
...@@ -171,7 +173,7 @@ public class App { ...@@ -171,7 +173,7 @@ public class App {
Animal anml = new Mammal(inputSpecies, inputHabitat, inputFood, inputName, inputFCol); Animal anml = new Mammal(inputSpecies, inputHabitat, inputFood, inputName, inputFCol);
animalList.add(anml); animalList.add(anml);
} }
else if (usrInput.equals("4")) { else if (inputClass.equals("4")) {
System.out.print(" Venomous Capability: "); System.out.print(" Venomous Capability: ");
String inputVeno = inputScan.nextLine(); String inputVeno = inputScan.nextLine();
......
No preview for this file type
...@@ -22,6 +22,7 @@ public class Avian extends Animal{ ...@@ -22,6 +22,7 @@ public class Avian extends Animal{
} }
return (super.getProfile() + "\nFeather Colour: " + featherColour return (super.getProfile() + "\nFeather Colour: " + featherColour
+ "\nKeratin Colour: " + keratinColour + "\nKeratin Colour: " + keratinColour
+ "\n" + pet()
+ "\n###################################"); + "\n###################################");
} }
......
No preview for this file type
...@@ -20,6 +20,7 @@ public class Fish extends Animal{ ...@@ -20,6 +20,7 @@ public class Fish extends Animal{
description = "A majestic " + scaleColour + " " + species + ". They live in the " + habitat + " and feed on " + food + "."; description = "A majestic " + scaleColour + " " + species + ". They live in the " + habitat + " and feed on " + food + ".";
} }
return (super.getProfile() + "\nScale Colour: " + scaleColour return (super.getProfile() + "\nScale Colour: " + scaleColour
+ "\n" + pet()
+ "\n###################################"); + "\n###################################");
} }
......
No preview for this file type
...@@ -20,6 +20,7 @@ public class Mammal extends Animal { ...@@ -20,6 +20,7 @@ public class Mammal extends Animal {
description = "An imtimidating " + furColour + " " + species + ". They live in the " + habitat + " and feed on " + food + "."; description = "An imtimidating " + furColour + " " + species + ". They live in the " + habitat + " and feed on " + food + ".";
} }
return (super.getProfile() + "\nFur Colour: " + furColour return (super.getProfile() + "\nFur Colour: " + furColour
+ "\n" + pet()
+ "\n###################################"); + "\n###################################");
} }
......
No preview for this file type
...@@ -20,6 +20,7 @@ public class Reptile extends Animal { ...@@ -20,6 +20,7 @@ public class Reptile extends Animal {
description = "An elusive " + species + ". They live in the " + habitat + " and feed on " + food + ". (Venomous rating: " + venomous + ")."; description = "An elusive " + species + ". They live in the " + habitat + " and feed on " + food + ". (Venomous rating: " + venomous + ").";
} }
return (super.getProfile() + "\nVenomous?: " + venomous return (super.getProfile() + "\nVenomous?: " + venomous
+ "\n" + pet()
+ "\n###################################"); + "\n###################################");
} }
......
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