Question: JAVA - Please do not do anything too fancy or advanced. Keep it basic. I did some, but I am stuck on other parts. I
JAVA - Please do not do anything too fancy or advanced. Keep it basic. I did some, but I am stuck on other parts. I am getting so lost on what I have already done and what still needs to be done.

Provided code classes: Sorry 3 are screenshots, Chegg wouldn't let me post it otherwise due to length. I think monkey is done?



4) Driver Class import java.util.ArrayList; import java.util.Scanner;
public class Driver { private static Scanner scanner = new Scanner(System.in); private static ArrayList
String menuChoice = ""; // local variable initializeDogList(); initializeMonkeyList();
while(!menuChoice.equalsIgnoreCase("q") ) { displayMenu(); menuChoice = scanner.nextLine(); switch(menuChoice) { case "1": intakeNewDog(scanner); System.out.println("...intakeNewDog() method still under construction"); break; case "2": intakeNewMonkey(scanner); break; case "3": reserveAnimal(scanner); break; case "4": printAnimals(); break; case "5": printAnimals(); break; case "6": printAnimals(); break; default: if(!menuChoice.equalsIgnoreCase("q") ) { System.out.println("Invalid input, please try again later."); } break; } } System.out.println("Goodbye. Thank you for using the Grazioso System."); }
// This method prints the menu options public static void displayMenu() { System.out.println(" "); System.out.println("\t\t\t\tRescue Animal System Menu"); System.out.println("[1] Intake a new dog"); System.out.println("[2] Intake a new monkey"); System.out.println("[3] Reserve an animal"); System.out.println("[4] Print a list of all dogs"); System.out.println("[5] Print a list of all monkeys"); System.out.println("[6] Print a list of all animals that are not reserved"); System.out.println("[q] Quit application"); System.out.println(); System.out.println("Enter a menu selection"); }
public static void initializeDogList() { Dog dog1 = new Dog("Spot", "German Shepherd", "male", "1", "25.6", "05-12-2019", "United States", "intake", false, "United States"); Dog dog2 = new Dog("Rex", "Great Dane", "male", "3", "35.2", "02-03-2020", "United States", "Phase I", false, "United States"); Dog dog3 = new Dog("Bella", "Chihuahua", "female", "4", "25.6", "12-12-2019", "Canada", "in service", true, "Canada");
dogList.add(dog1); dogList.add(dog2); dogList.add(dog3); }
// Adds monkeys to a list for testing //Optional for testing public static void initializeMonkeyList() { Monkey monkey1 = new Monkey("Bob", "2", "male", "1", "22", "05-20-2020", "United States", "intake", false, "United States"); monkeyList.add(monkey1); }
// Complete the intakeNewDog method // The input validation to check that the dog is not already in the list // is done for you public static void intakeNewDog(Scanner scanner) { System.out.println("What is the dog's name?"); String name = scanner.nextLine(); for(Dog dog: dogList) { if(dog.getName().equalsIgnoreCase(name)) { System.out.println(" This dog is already in our system "); return; //returns to menu } }
// Add the code to instantiate a new dog and add it to the appropriate list } System.out.println("What is the monkey's tail length?"); String tailLength = scanner.nextLine(); System.out.println("What is the monkey's gender?"); String gender = scanner.nextLine(); System.out.println("What is the monkey's age?"); String age = scanner.nextLine(); System.out.println("What is the monkey's weight?"); String weight = scanner.nextLine(); System.out.println("What is the monkey's acquisition date?"); String acquisitionDate = scanner.nextLine(); System.out.println("What is the monkey's acquisition country?"); String acquisitionCountry = scanner.nextLine(); System.out.println("What is the monkey's training status?"); String trainingStatus = scanner.nextLine(); System.out.println("Is this monkey reserved?
// Complete reserveAnimal // You will need to find the animal by animal type and in service country public static void reserveAnimal(Scanner scanner) { System.out.println("The method reserveAnimal needs to be implemented"); // FOR PROJECT TWO^ }
// Complete printAnimals // Include the animal name, status, acquisition country and if the animal is reserved. // Remember that this method connects to three different menu items. // The printAnimals() method has three different outputs // based on the listType parameter // dog - prints the list of dogs // monkey - prints the list of monkeys // available - prints a combined list of all animals that are // fully trained ("in service") but not reserved // Remember that you only have to fully implement ONE of these lists. // The other lists can have a print statement saying "This option needs to be implemented". // To score "exemplary" you must correctly implement the "available" list. public static void printAnimals() { System.out.println("The method printAnimals needs to be implemented"); // FOR PROJECT TWO^ } }
3. Next, you will complete the intakeNewDog() method. Your completed method should do the following: Prompt the user for input Include input validation. Note: The required input validation has already been included in the starter code; be sure to review it. . Set data for all attributes bashkon user input Add the newly instantiated dog to an ArrayList Hint: Remember to refer to the accessors and mutators in the Dog and Rescue Animal classes as you create this method. 4. Next, you will implement the intakeNewMonkey0 method. Before you do this, you will need to create a monkey ArrayList in the Driver.java class. Refer to the dog ArrayList for an example. Then, begin implementing the intakeNewMonkeyl) method. Your completed method should do the following: Prompt the user for input - Include input validation for the monkey's name and species type. If the user enters an invalid option, the program should print an error message. Set data for all attributes based on user input . Add the newly instantiated monkey to an ArrayList Hint: Remember to refer to the accessors and mutators in your Monkey and Rescue Animal classes as you create this method. IMPORTANT: In the Module Five milestone, you began implementing this method but were not required to include input validation. Be sure to include input validation for your Project Two submission. 5. Next, you will implement the reserveAnimal() method. Your completed method should do the following: Prompt the user for input. The user should enter their desired animal type and country If there is an available animal which meets the user's input criteria, the method should access an animal object from an ArrayList. If there are multiple animals that meet these criteria, the program should access the first animal in the ArrayList. The method should also update the "reserved" attribute of the accessed animal. If there is not an available animal which meets the user's input criteria, the method should output feedback to the user letting them know that no animals of that type and location are available. 6. Finally, you have been asked to implement a printAnimals() method that provides easy-to-read output displaying the details of objects in an ArrayList. . To demonstrate this criterion in a "proficient" way, your implemented method must successfully print the ArrayList of dogs or the ArrayList of monkeys. To demonstrate this criterion in an "exemplary way, your implemented method must successfully print a list of all animals that are "in service" and "available" 0 1) RescueAnimal class **DO NOT EDIT** import java.lang.String: public class Rescue Animal { // Instance variables private String name; private String animalType: private String gender; private String age; private String weight; private String acquisition Date: private String acquisitionCountry: private String trainingStatus private boolean reserved; private String in Service Country // Constructor public RescueAnimall) { } public String getNamel) { return name; } public void setName(String name) { this.name = name; } public String getAnimalTypel { return animalType: } public void setAnimalType(String animalType) { this.animalType = animalType; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getAge() { return age; } public void setAge(String age) { this age = age; } public String getWeight() { return weight; } public void setWeight(String weight) { this.weight = weight; } public String getacquisition Date!) { return acauisition Date: } public void setAcquisition Date/String acquisition Rate) { this.acquisitionDate acquisition Date: } public String getAcquisition Location!) { return acquisition Country: } public void setAcquisition Location(String acquisitionCountry) { this.acquisitionCountry = acquisition Country } public boolean getReserved!) { return reserved; } public void setReserved boolean reserved) { this.reserved reserved; } public String getinServiceLocation!) { return in Service Country: } public void setin Service Country/String inservice Country) { this.inService Country = in Service Country: } public String get TrainingStatusi) { return trainingStatus: } public void set Trainingstatus/String trainingStatus) { this.trainingstatus = trainingStatus: 1 } 1) Dog class **DO NOT EDIT** public class Dog extends RescueAnimal { // Instance variable private String breed; // Constructor public Dog/String name, String breed, String gender, String age, String weight, String acquisitionDate String acquisitionCountry String trainingStatus, boolean reserved, String joServiceCountry) { setNameame); setBreed breed); set Geoderigender); setAgelage); SetWeight weight); setAcquisition Ratelacquisition Rate); SetAcouisitionLocationlacquisitionCountry); settrainingStatus/trainingStatus); setReserved(reserved); setln Service Country ServiceCountry): } // Accessor Method public String getBreed return breed; } // Mutator Method public void setBreed/String gegBreed) { breed = dog Breed } } 1) Monkey Class // Instance variables public class Monkey extends Rescue Animal private String tailLength: private String height: private String bodyLength: private String species; //Constructors public Monkeve) { taillength = ""; height="" bedxlength=""; species=""; } public Monkey/String name, String tailleogth, String gender, String age, String weight, String acquisition Rate, String acquisitionCountry, String trainingStatus, boolean reserved, String inserviceCountry) { setName(name); setTaillength(taillength); setHeight(height); setBodyLength(bodvlength); setSpesies(species); setGenderigender); setegelage); set Weight weight); setAcquisition Ratelacauisition Rate); setAcquisitionLocation acquisitionCountry); set Training Statustraining Status); setReserved reserved); setla Service Country in Service Country); //TODO height, bodyLength, species } I/ Accessor Methods (the getters) public String setTailleogth!) { return tailleogth } public void setTaillength/String taillength) { this.taillength = taillength: } public String eetleieht) { return height; } public void setHeight(String height) { this.height = height; } public String getBodulength!) { return besyleogth: } public void setBodyLength/String bodyleogth) { this.bodyLength = bodyLength: } public String Eet Spesied) { return species; } public void setSpecies(String species) { this species = species; } // Mutators (setter methods) //TODO Create setters for all Monkey attributes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
