You are to write a boarding system for a Cruise ship in java. The system will print a menu with which the user will interact to assign passengers to each cabin of a cruise ship.
Design a program for a Cruise Ship with twelve cabins using code like the code provided near the end of your notes. Start by checking that the code works.
Once the basic code runs, put the code for 'Views All cabins' and Adds customer to cabin, into separate procedures, and test it works. You can build up your test cases as you develop your program (see testing below).
Then add a menu system which will allow the user to choose what they want to select. Enter an 'A' to add a customer to a cabin, and a V to view all cabins. Implement each as a method. When an A is pressed, it should do the Add method; a V should do the View method.
One by one, add extra methods to do each of the following. The user should be able to choose from the menu what the program does.
E: Display Empty cabins
D: Delete customer from cabin
F: Find cabin from customer name
S: Store program data into file
L: Load program data from file
O: View passengers Ordered alphabetically by name. (Implement your own sort algorithm)
Create a second version of the Cruise Ship program using an array of Cabin objects. Create a class called Cabin and another class called Passenger. Each cabin should hold up to 3 passengers with the following additional information.
Add an additional option to the menu. 'T' that will give the user the option to print the expenses per passenger as well as the total expenses of all passengers. Otherwise, the program should function as in Task 1.
Add a waiting list to your Cruise Ship class version.
Modify your 'A: Add' and D: Delete as follows:
Extra marks will be awarded if you implement the waiting list queue as a circular queue.
Create a table of test cases showing how you tested your program (see below for example). Write a brief (no more than one page) discussion of how you chose your test cases to ensure that your tests cover all aspects of your program. Additionally, write a few paragraphs (up to 1 page) explaining which of the solutions (Array or Class) you think is better and why. Think about which is easier to read/understand, which is easier to modify if necessary, and any other comments you can think of.
Test Case | Expected Result | Actual Result | Pass/Fail |
(Cabins Initialised correctly) After program starts, Press 'V' | Displays 'e' for all cabins | Displays 'e' for all cabins | Pass |
(Add customer "Bob" to cabin 5) Select A, enter "Bob" | Press 'v' Displays "Bob" for cabin 5 | Displays "Bob" for cabin 4 | X |
Note: Solutions should be java console applications (not windows).