JAVA PROGRAMMING

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

JAVA PROGRAMMING

Post by answerhappygod »

JAVA PROGRAMMING
Java Programming 1
Java Programming 1 (45.18 KiB) Viewed 21 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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply