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 Scanner(System.in);
public void menuLoop(){
while (true){
System.out.println("1. Add Dog
2. Add Monkey
3. Reserve Animal
4. Display Animals
5. Exit");
int choice = scanner.nextInt();
switch (choice){
case 1:
intakeDog();
break;
case 2:
intakeMonkey();
break;
case 3:
reserveAnimal();
break;
case 4:
displayAnimals();
break;
case 5:
return;
default:
System.out.println("Invalid choice. Please try again.");
}
}
}
private void intakeDog(){
System.out.println("Enter Dog details:");
// Prompt for and read in the dog's details
// Add the new dog to the dogs ArrayList
}
private void intakeMonkey(){
System.out.println("Enter Monkey details:");
// Prompt for and read in the monkey's details
// Add the new monkey to the monkeys ArrayList
}
private void reserveAnimal(){
System.out.println("Enter 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.println("Animals 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!