Page 1 of 1

JAVA PROGRAMMING

Posted: Wed Apr 27, 2022 3:06 pm
by answerhappygod
JAVA PROGRAMMING
Java Programming 1
Java Programming 1 (45.18 KiB) Viewed 23 times
Question 2 In order to enhance the reservation system, write an application to record the reservation detail in an array with maximum 10 elements. You may use the class given as below. The application should prompt the user to key in the number of pax and room type. The range of number of pax should be within 1 to 6 inclusively. The room type must be either single, double or suite only. Once the inputs are validated, create a reservation object and store in the array. Allow the user to key in the value again if the user keyed in invalid data input. Display all the reservation records. (20 marks) [Hint: You should consider checking for InputMismatchException.] = public class Reservation{ private static int number 1; private int reserveID, pax; private String roomTypei public Reservation (int pax, String type) { reserveID 1000 + number; this: pax = рах; roomType = type: number++; } public String toString() { return "Reservation ID: + reserveID + "\nNumber of Pax: " + pax + "\nRoom type: + roomType: } } 11