The Commodore of the Coconut Grove Sailing Club needs a simple program to track the costs associated with the various sailing boats and coach (power) boats that the club owns. The sad truth about owning boats is they need maintenance - we all know what "boat" means! In order to control expenditure, the Commodore has a policy that the club may not spend more on a boat than it cost to buy the boat. The program must allow for an arbitrary number of boats (hint: use an ArrayList), and must hold the following information about each boat:

Data about the fleet is initially provided to the program as a Comma Separated Values file, such as FleetData.csv, whose name is given as a command line parameter. Upon exiting the program the fleet data must be saved in serialized form in a file called FleetData.db. In subsequent runs no command line option need be given, and the fleet data is instead read in from the FleetData.db file. (Hint: Put all the file handling methods in your main class.) You will need to create two configurations in IntelliJ, one for the initializing run with the .csv command line parameter, and one "normal" one with no command line parameter.

Once the fleet data is loaded the program must offer a menu of three options:

  1. Print the boat inventory
  2. Add a boat
  3. Remove a boat
  4. Request permission to spend money on a boat, subject to the Commodore's policy
  5. Exit
The program must be user friendly, but may assume that the user will enter reasonable data values:

Here's what an initialising run should look like (with the keyboard input shown in italics) ...

Welcome to the Fleet Management System
--------------------------------------

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : W
Invalid menu option, try again
(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : P

Fleet report:
    POWER   Big Brother          2019 Mako        20' : Paid $ 12989.56 : Spent $     0.00
    SAILING Moon Glow            1973 Bristol     30' : Paid $  5500.00 : Spent $     0.00
    SAILING Osita                1988 Tartan      40' : Paid $ 11500.07 : Spent $     0.00
    POWER   Rescue II            2016 Zodiac      12' : Paid $  8900.00 : Spent $     0.00
    Total                                             : Paid $ 38889.63 : Spent $     0.00

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : A
Please enter the new boat CSV data          : SAILING,Finesse,1974,Tartan,34,9200.50

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : P

Fleet report:
    POWER   Big Brother          2019 Mako        20' : Paid $ 12989.56 : Spent $     0.00
    SAILING Moon Glow            1973 Bristol     30' : Paid $  5500.00 : Spent $     0.00
    SAILING Osita                1988 Tartan      40' : Paid $ 11500.07 : Spent $     0.00
    POWER   Rescue II            2016 Zodiac      12' : Paid $  8900.00 : Spent $     0.00
    SAILING Finesse              1974 Tartan      34' : Paid $  9200.50 : Spent $     0.00
    Total                                             : Paid $ 48090.13 : Spent $     0.00

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : R
Which boat do you want to remove?           : Lost Soul
Cannot find boat Lost Soul

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : R
Which boat do you want to remove?           : BIG BROTHER

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : p

Fleet report:
    SAILING Moon Glow            1973 Bristol     30' : Paid $  5500.00 : Spent $     0.00
    SAILING Osita                1988 Tartan      40' : Paid $ 11500.07 : Spent $     0.00
    POWER   Rescue II            2016 Zodiac      12' : Paid $  8900.00 : Spent $     0.00
    SAILING Finesse              1974 Tartan      34' : Paid $  9200.50 : Spent $     0.00
    Total                                             : Paid $ 35100.57 : Spent $     0.00

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : e
Which boat do you want to spend on?         : Raptor
Cannot find boat Raptor

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : e
Which boat do you want to spend on?         : Moon Glow
How much do you want to spend?              : 3456.78
Expense authorized, $3456.78 spent.

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : p

Fleet report:
    SAILING Moon Glow            1973 Bristol     30' : Paid $  5500.00 : Spent $  3456.78
    SAILING Osita                1988 Tartan      40' : Paid $ 11500.07 : Spent $     0.00
    POWER   Rescue II            2016 Zodiac      12' : Paid $  8900.00 : Spent $     0.00
    SAILING Finesse              1974 Tartan      34' : Paid $  9200.50 : Spent $     0.00
    Total                                             : Paid $ 35100.57 : Spent $  3456.78

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : e
Which boat do you want to spend on?         : moon glow
How much do you want to spend?              : 2000
Expense authorized, $5456.78 spent.

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : e
Which boat do you want to spend on?         : moon Glow
How much do you want to spend?              : 250
Expense not permitted, only $43.22 left to spend.

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : x

Exiting the Fleet Management System
Here's what a subsequent run should look like (with the keyboard input shown in italics) ...
Welcome to the Fleet Management System
--------------------------------------

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : P

Fleet report:
    SAILING Moon Glow            1973 Bristol     30' : Paid $  5500.00 : Spent $  5456.78
    SAILING Osita                1988 Tartan      40' : Paid $ 11500.07 : Spent $     0.00
    POWER   Rescue II            2016 Zodiac      12' : Paid $  8900.00 : Spent $     0.00
    SAILING Finesse              1974 Tartan      34' : Paid $  9200.50 : Spent $     0.00
    Total                                             : Paid $ 35100.57 : Spent $  5456.78

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : e
Which boat do you want to spend on?         : Osita
How much do you want to spend?              : 4525.99
Expense authorized, $4525.99 spent.

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : p

Fleet report:
    SAILING Moon Glow            1973 Bristol     30' : Paid $  5500.00 : Spent $  5456.78
    SAILING Osita                1988 Tartan      40' : Paid $ 11500.07 : Spent $  4525.99
    POWER   Rescue II            2016 Zodiac      12' : Paid $  8900.00 : Spent $     0.00
    SAILING Finesse              1974 Tartan      34' : Paid $  9200.50 : Spent $     0.00
    Total                                             : Paid $ 35100.57 : Spent $  9982.77

(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : x

Exiting the Fleet Management System

You must ...

Your must submit in Blackboard: You must sit with the TA when (s)he runs your program in the lab session so you can see together how well it works. Your program will be assessed using this marking scheme.

The project is due on 2nd December, but can also be submitted earlier. I cannot give any extensions, it's not possible, don't ask, even if you have spear through your chest (I might have some sympathy, but I still can't give an extension). Therefore you should aim for 25th November, and show your work in that lab session.

Please review the policies on assessment in the administration document.

Answer