6. In the Driver.java class, modify the main method. In main(), you must create a menu loop that does the following: o Displays the menu by calling the displayMenu method. This method is in the Driver.java class. o Prompts the user for input o Takes the appropriate action based on the value that the user entered

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

I need help in my intro to programming class (Java) in creating a loop that covers the criteria in the first picture also included begining of the Driver class that includes the menu options.

6. In the Driver.java class, modify the main method. In main(), you must create a menu loop that does the following:
• Displays the menu by calling the displayMenu method. This method is in the Driver.java class.
o Prompts the user for input
o Takes the appropriate action based on the value that the user entered
Transcribed Image Text:6. In the Driver.java class, modify the main method. In main(), you must create a menu loop that does the following: • Displays the menu by calling the displayMenu method. This method is in the Driver.java class. o Prompts the user for input o Takes the appropriate action based on the value that the user entered
10 import java.util.ArrayList;
2 import java.util.Scanner;
3
4 public class Driver {
private static ArrayList<Dog> dogList = new ArrayList<Dog> ();
// Instance variables (if needed)
8
//Monkey Array
private static ArrayList<Monkey> monkeyList = new ArrayList<Monkey> ();
10
11e
public static void main (String [] args) {
12
13
14
initializeDogList ();
initializeMonkeyList ();
15
16
// Add a loop that displays the menu, accepts the users input
// and takes the appropriate action.
// For the project submission you must also include input validation
// and appropriate feedback to the user.
// Hint: create a Scanner and pass it to the necessary
// methods
// Hint: Menu options 4, 5, and 6 should all connect to the printAnimals () method.
17
18
19
20
21
22
23
24
25
26
27
// This method prints the menu options
280
29
30
public static void displayMenu () {
System.out.println ("\n\n");
System.out.println ("\t\t\t\tRescue Animal System Menu");
System.out.println ("[1] Intake a new dog");
31
32
33
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 ("[a] Quit application");
em.out.println ():
System.out.println ("Enter a menu selection");
34
35
36
37
38
Sys
39
40
41
42
Transcribed Image Text:10 import java.util.ArrayList; 2 import java.util.Scanner; 3 4 public class Driver { private static ArrayList<Dog> dogList = new ArrayList<Dog> (); // Instance variables (if needed) 8 //Monkey Array private static ArrayList<Monkey> monkeyList = new ArrayList<Monkey> (); 10 11e public static void main (String [] args) { 12 13 14 initializeDogList (); initializeMonkeyList (); 15 16 // Add a loop that displays the menu, accepts the users input // and takes the appropriate action. // For the project submission you must also include input validation // and appropriate feedback to the user. // Hint: create a Scanner and pass it to the necessary // methods // Hint: Menu options 4, 5, and 6 should all connect to the printAnimals () method. 17 18 19 20 21 22 23 24 25 26 27 // This method prints the menu options 280 29 30 public static void displayMenu () { System.out.println ("\n\n"); System.out.println ("\t\t\t\tRescue Animal System Menu"); System.out.println ("[1] Intake a new dog"); 31 32 33 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 ("[a] Quit application"); em.out.println (): System.out.println ("Enter a menu selection"); 34 35 36 37 38 Sys 39 40 41 42
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT