Question: Vehicle - matriculationNB: String - mark: String - owner: String -ManufacturingYear :int + Vehicle (----All Parameters----) + setters/getters +toString(): String Car - color: String +

Vehicle

- matriculationNB: String - mark: String

- owner: String

-ManufacturingYear :int

+ Vehicle (----All Parameters----) + setters/getters

+toString(): String

Car

- color: String

+ Car (----All Parameters----)

+ setter/getter

+ toString(): String

Parking

- name: String

- Vehicle : ArrayList

+ Parking (name: String)

+ getName(): String

+ addCar(c: Car): void

+ addVan(v: Van): void

+ getVehicles(): ArrayList

+ countVan(): int

+ countVanManufacturedIn(year:int): int + displayCarsOf( owner: String): void + toString(): String

Van

- length: int

+ Van (----All Parameters----) + setter/getter

+ toString(): String

Part 1: Implement the following classes (Vehicle (10 Pts), Car (10 Pts), Van (10 Pts) and Parking (35 Pts),). A class 'Vehicle' is described by the instance variables: matriculation number, mark, owner's name and Manufacturing Year. The method toString () return a string containing all the information of the vehicle. The classes 'Car' and 'Van' derived from the class 'Vehicle'. The class 'Car' has an additional instance variable denoting the color of the car. The class 'Van' has an additional instance variable denoting the length of the van.

The class 'Parking' is to manage the entry and exit of vehicles from the parking. The class 'Parking' is described by a name and an array list of vehicles.

Note:

o The method countVanManufacturedIn return the number of van exist into the parking and manufactured in a specific year.

Part 2: Implement a driver class (main class) as follows: (35 Pts),

1. Create a Parking object with name read from the user.

2. Add to the parking object some cars and vans as many as the user wants

3. Display the number of vans in the parking object using the corresponding method in the parking class. 4. Count the vans, which have manufactured in 2010 using the corresponding method in the parking class. 5. Test the displayCarsOf method by reading an owner name from the user and display its cars. 6. Display the marks of red cars and vans of length > 3

7. Display the description of all cars only.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!