solution
PART 1 – CODE Automobile manufacturer Sonda requires an application which calculates the price of its models in its inventory. The company has two car models one of which is Sivic and the other is Sity and their base prices are 50000 TL and 40000 TL, respectively. If requested the following optionals can be added to the cars. Each optional has a cost as listed below. If an optional is selected its cost is added to the Car’s price and multiple optionals may be selected.
Optional Cost Airbag 3000 TL
Music System 1000 TL
Automatic Breaking System (ABS) 5000 TL
Sunroof 2000 TL
In addition Sonda has also motorbike models: Racer and Scooter and their base prices are 60000 TL and 20000 TL respectiely. Motorbikes have also the following optionals that may be selected additionally. Optional Cost Automatic Breaking System (ABS) 5000 TL Seat Heating 2000 TL Create the required classes and implement the necessary functionalities
• to add vehicles configured with different optionals to the inventory and
• to print the contents of the inventory of the company. An example output that shows the content of the inventory is shown below. After adding the following vehicles with the stated optionals into inventory, when you print the contents of the inventory, it should produce following output:
Sivic with ABS, Music System, Air Bag optional having a total price of 59000 TL Sivic with ABS, Sunroof having a total price of 57000 TL Sity with Music System, Sunroof having a total price of 43000 TL Racer with ABS, Seat Heating having a total price of 67000 TL Scooter with Seat Heating having a total price of 22000 TL TOTAL : 5 Vehicles including 3 Cars and 2 Motorbikes having a total price of 248000 TL In your design you should consider the followings: • In addition to existing vehicle types which are car and motorbike, in the future new vehicle types such as motor yacht, truck can introduced into your application. 2
• Inventory class should not be affected when new vehicle types are defined, but still be able to print its content
• Force all the vehicles to have a cost function which returns their price
• All vehicles can be configured with zero or more optionals
• Define a checked exception and throw that exception when a vehicle is configured with an invalid optional that is a motorbike can not have a sunroof.
• Also provide a test class which produces the example output given above
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"

