Question: 1. Using Object-oriented Programming approach, develop a CH program for a shipping company to manage their inventory of ships. The company keeps the following information about each ship: a. The name of the ship b. The year that the ship was built c. The address that the ship was registered at. It includes the country where the ship was registered and the registrar office that keeps the registration record. The UML class diagram for the inventory system is given as in Figure 1.0. In Address class, the function set is a mutator used for specifying the member variables, registrar and country, with values obtained from the function's arguments, while the functions getRegistrar and getCountry are accessors. As for the class Ship, the function read is a mutator that specifies all the member variables, name, yearMade and address, with values obtained from the keyboard. The function print on the other hand, is used to print the member variables. Ship Address .name: string - registrar: String -year Made: string - country: string address: Address + Ship () + Address 0 + print(): void + set(string, string): void + read(): void Figure 1.0 Class diagram for the ship inventory system The implementation of your program must be based on the class diagram and specifications given above. Also, your program should use a dynamically allocated array to store the list of ships. Furthermore, the program should provide a menu-driven internetion for the user to use the program. It should allow the user to add the record for * ship one at a time. It should also provide an operation to display the number of ships and the information of each ship. Figure 2.0 illustrates an example run of the program. Note that the bold texts represent user inputs. MENU 1. Add a ship 2. Display ships 3. Exit Choose an operation => 1 >> Ship Name: Super Gemilang Year Built: 2010 The address the ship was registered: Registrar office: Malaysian Shipping Council Country: Malaysia Press any key to continue ES MENUS 1. Add a ship 2. Display ships 3. Exit Choose an operation => 1 >> Ship Name: Orion Cruise Year Built: 2000 The address the ship was registered: Registrar office: Shipping Authority Board Country: Singapore Press any key to continue... == MENU = 1. Add a ship 2. Display ships 3. Exit Choose an operation => 2
> Ship Name: Super Gemilang Year Built: 2010 Registered at: Malaysian Shipping Council, Malaysia Ship Name: Orion Cruise Year Built: 2000 Registered at: Shipping Authority Board, Singapore Press any key to continue... - MENU 1. Add a ship 2. Display ships 3. Exit Choose an operation => 3 Figure 2.0: Example run Attention for the exercise: 1. You need to put your name and the description of the program at the top of your cpp file in the lab exercises. 2. You are also are required to give some comments regarding the program as your documentation