Introduction

Gilligan's Cruise Company (GCC) is planning to modernize their ship, the SS Minnow, with the latest technology. One aspect of their upgrades is how they keep track of passenger shipboard accounts and whether they are on or off the ship.

In the past, they kept track of customer embarking and disembarking by having a security person look at the passenger ID and letting them on or off the ship. With their new upgrade, they will have a computer program keep track of each passenger's location (whether they are on or off the ship), as well as each passenger's ship accounts (bar bills, gift shop purchases, island tours, etc.). Passengers will carry a cruise card that they will use when embarking, disembarking and making a purchase. All cruise itineraries will include a stop at Gilligan's Island, the cruise line's private island, for a three hour tour. While on the island, and at other ports of call, passengers may also use their shipboard accounts to buy coconuts and other souvenirs.

Your company has been selected by GCC to write this computer program, and you have been selected by your boss to design and code it. GCC has given the following specifications for their new system:

  • Information for each passenger will be kept in a single data type (struct) and will consist of:
    • A unique passenger ID (integer)
    • Passenger First Name (char string of 25 characters)
    • Passenger Last Name (char string of 35 characters)
    • Current balance of passenger shipboard account (double)
    • Passenger Location (char)
    • If passenger is on-board, the value of this data will be 1
    • If the passenger is visiting the current island, the value of this data will be 0
  • The passenger data will be read from an ASCII file at the start of the program. The data will consist of the unique ID, and the passenger's first and last name. Each line in the file will contain a single data item. When the data is read, the balance of the passenger's account will be set to 0.00, and the passenger will be considered to be off the ship (Location value is 0).
  • Passengers will be identified by their unique ID. Thus when a passenger embarks, disembarks or makes an on-board purchase, their ID card is scanned, and the unique id is read from the magnetic strip on their cruise card. This ID will be used to search for the customer information so that it can be updated.
  • As passengers arrive on the ship, the passenger location value will be set to 1. If the passenger location value indicates that they are already on the ship, a message will be printed stating that the passenger must have slipped off the ship without going through security.
  • Similar to #3, when a passenger leaves the ship, the location value will be set to 0. If the location value indicates that they are currently off the ship, a message will be printed stating that the passenger must have gotten on the ship without going through security.
  • When a passenger makes an on-board purchase, the amount of the purchase will be added to their shipboard account. If the location value of the passenger indicates they are currently off the ship, a message will be printed stating that the passenger location is incorrect. The location value will be set to 1 and the amount of the purchase will be added to their shipboard account.
  • Similar to #6, when a passenger makes an off-board purchase, the amount of the purchase will be added to their shipboard account. If the location value of the passenger indicates they are currently on the ship, a message will be printed stating that the passenger location is incorrect. The location value will be set to 0 and the amount of the purchase will be added to their shipboard account.
  • The program must have the ability to print:
    • Information for a single passenger (identified by the unique ID)
    • Passenger information for all passengers currently on board
    • Passenger information for all passengers currently on shore
    • When printing passenger information, the passenger's Unique ID, First and Last name, and current shipboard account balance is printed
  • At the end of the cruise, all passengers will exit the ship. The program will then calculate the total amount of money the passengers spent on the cruise, compute the average amount of money spent per passenger, and print this information.

Implementation

The specifications for this project have a great deal of detail. However, the fact that they are detailed can be used to your advantage, in that you can break the project into smaller units and work on them separately to create the complete project.

  • You will implement this program using singly Linked Lists. You will create a linked list node struct that will contain a passenger struct, and a pointer to a linked list node.
  • You will have, at a minumum, two linked lists. One for passengers on board the ship (onShip), and one for passengers that are not on the ship (offShip).
  • The nodes in the linked lists will always be ordered by Passenger ID.
  • Your program will be menu driven. The program will contain a main menu, and several choices from this menu will bring up a sub-menu. See the Menu Specifications below.
  • A sample script and output will be provided that you may test with your program. Your program must respond to inputs in the same manner that the sample script responds. In other words, your program should not add unnecessary prompts for user input, nor should it skip prompts for input (or prompt for multiple data items with a single prompt).
  • Two input files containing Names and Passenger IDs are provided, one for testing, and one for a more realistic number of passengers.

Menu Specifications

  • Main Menu: The main menu will contain the following choices and functionality:
    • Read Passenger Mainfest
    • Prompt the user for a filename containing the "Passenger Manifest."
    • Open this file and read the information from the file, creating Passengers and adding them to the offShip list
    • If the file cannot be found, print a message stating this fact, and return to the Main Menu.
  • Embark all passengers
    • Move all passengers from the offShip list to the onShip list
  • Passenger Information
    • Display the Passenger Information Menu (See below)
  • Print Menu
    • Display the Print Menu (See below)..
  • Debark all passengers
    • Move all passengers from the onShip list to the offShip list
  • Quit
    • Remove all nodes from both the onShip and offShip lists and free the memory.
    • Exit the program

Passenger Information Menu

  • Embark Passenger
    • The program prompts for the passenger ID. The passenger node is removed from the offShip list and added in the proper position to the the onShip list. The passenger location is set to be on board.
    • If the passenger ID is not found in the offShip list, the onShip list is searched. If the passenger is found in the onShip list, a message stating so is written to the console, and the program returns to the main menu.
    • If the passenger is not found in either list, a message stating an incorrect ID was entered is written to the console, and the program returns to the Passenger Information menu.
  • Debark Passenger
    • The program prompts for the passenger ID. The passenger node is removed from the onShip list and added in the proper position to the the offShip list. The passenger location is set to be of the ship.
    • If the passenger ID is not found in the onShip list, the offShip list is searched. If the passenger is found in the offShip list, a message stating so is written to the console, and the program returns to the main menu.
    • If the passenger is not found in either list, a message stating an incorrect ID was entered is written to the console, and the program returns to the Passenger Information menu.
  • Passenger OnBoard Purchase
    • The program prompts for the passenger ID. The program then prompts for the amount of purchase as a floating point value.
    • The program searches for the passenger node, first in the onShip list, then (if it is not found in the onShip list) the offShip list is searched.
    • Once the node is found, the purchase amount is added to the current balance of the shipboard account for that passenger. Also, the Passenger location is set to 1 if it is not already (if the passenger was in the offShip list).
    • If the passenger ID is not found, a message stating an incorrect ID was entered is written to the console, and the program returns to the Passenger Information menu.
  • Passenger OffBoard Purchase
    • The program prompts for the passenger ID. The program then prompts for the amount of purchase as a floating point value.
    • The program searches for the passenger node, first in the offShip list, then (if it is not found in the offShip list) the onShip list is searched.
    • Once the node is found, the purchase amount is added to the current balance of the shipboard account for that passenger. Also, the Passenger location is set to 0 if it is not already (if the passenger was in the onShip list).
    • If the passenger ID is not found, a message stating an incorrect ID was entered is written to the console, and the program returns to thePassenger Information menu.
  • Synchronize Passenger Lists
    • The program traverse through the two passenger lists. Any passenger in the onShip list with the location set to 0 will be removed from the onShip list and moved to the offShip list. Any passenger in the offShip list with the location set to 1 will be removed from the offShip list and moved to the onShip list.
  • Return to Main Menu

Print Menu:

  • Print Account for Single Passenger
    • Prompt the user for the Passenger ID.
    • Search both onShip and offShip lists until the passenger is found
    • Print the information for that passenger.
    • If the Passenger ID is not found, write a message to the console stating that fact and return to the Print Menu.
  • Print All Passenger Accounts
  • Print Accounts for onShip Passengers
  • Print Accounts for offShip Passengers
  • Return to Main Menu
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.