Question: import java.util.ArrayList; import java.util.Scanner; public class Driver { private ArrayList dogs = new ArrayList < > ( ) ; private ArrayList monkeys = new ArrayList
import java.util.ArrayList;
import java.util.Scanner;
public class Driver
private ArrayList dogs new ArrayList;
private ArrayList monkeys new ArrayList;
private Scanner scanner new ScannerSystemin;
public void menuLoop
while true
System.out.println Add Dog
Add Monkey
Reserve Animal
Display Animals
Exit";
int choice scanner.nextInt;
switch choice
case :
intakeDog;
break;
case :
intakeMonkey;
break;
case :
reserveAnimal;
break;
case :
displayAnimals;
break;
case :
return;
default:
System.out.printlnInvalid choice. Please try again.";
private void intakeDog
System.out.printlnEnter Dog details:";
Prompt for and read in the dog's details
Add the new dog to the dogs ArrayList
private void intakeMonkey
System.out.printlnEnter Monkey details:";
Prompt for and read in the monkey's details
Add the new monkey to the monkeys ArrayList
private void reserveAnimal
System.out.printlnEnter Animal details to reserve:";
Prompt for and read in the animal's details
If the animal is found in the ArrayList and is not reserved, reserve it
Otherwise, print feedback to the user
private void displayAnimals
System.out.printlnAnimals in service and available:";
Loop through the ArrayLists and print details of animals that are in service and not reserved
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
