Question: I need another way for the following java code : import java.io.*; import java.util.*; public class ResortTester { ArrayList reserve = new ArrayList (); public

I need another way for the following java code :

import java.io.*; import java.util.*;

public class ResortTester { ArrayList reserve = new ArrayList<>(); public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(System.in); MusandamResort serv=new MusandamResort(); serv.read(); System.out.println("**** Welcome to Musandam Resort **** "); int choice = 0; while ( choice != 5 ) { menu(); choice = input.nextInt(); switch(choice){ case 1 -> serv.addReservation(); case 2 -> serv.checkReservation(); case 3 -> serv.removeReservation(); case 4 -> serv.displayReservation(); default -> { if (choice == 5) { System.out.println("Thank you for using the reservation system."); System.exit(0); } // exit System.out.println("invalid choice number"); } } }

}

public static void menu() { System.out.println(" 1- to make a reservation"); System.out.println("2- to check a specific reservation"); System.out.println("3- to cancel a reservation"); System.out.println("4- to display all reservations"); System.out.println("5- to exit"); System.out.print("Input your choice: "); }

}

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 Databases Questions!