Specification

The Scuba ride sharing business allows people to book and share a ride on a Scuba boat. The business has three boats for hire, numbered 1-3; each boat travels a different route. A route is divided into steps numbered 0 to s - 1, where s is the number of stops. A Scuba client selects the boat, enters their Scuba id, and the numbers of the stops where they get on and get off the boat. A booking looks like this:

Boat: 1
Stops 0-2
Scuba id: 101
Trip: 0 2

Scuba client 101 has now booked a trip on boat 1 from stops 0 to 2. Multiple clients can book a trip on a boat; they share the cost of the trip.

Assume that this is the only booking for the boat. The boat then goes from stop 0 to 2 and shows a simulation of the trip that looks like this:

Scuba1 with Ed
Stop 0
On: Homer101
Stop 2
Off: Homer101

The boat Scuba1 is driven by Ed. Homer gets on at stop 0, and gets off at stop 2.

A client starts with $100 and is charged $10 for each stage (between numbered stops). If two people share a stage, then they pay an equal amount for that stage; the cost is shared between clients. In this case, Homer is the only passenger and travels two stages, so is charged $20 for the trip. The client data base is shown like this:

Homer (Scuba101) has $80.00
Marge (Scuba102) has $100.00

The system has a menu with 7 choices; a choice is a single character input:

  • a: add a client
  • r: remove a client
  • b: make a booking
  • g: go (run the boats)
  • s: show the clients
  • f: store to file and exit
  • x: exit
  • anything else: help

The system always read from file on startup, if a file exists. The full specification is shown in Appendix A, and the base code is shown in Appendix B and posted in Assignments/1. IO traces are shown in io.pdf (formatted, with explanation) and in io.txt (straight text) in Assignments/1.

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.