Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following UML diagram: Part 1: Implement the following classes: Check the notes below before you start: AccidentReport - date: Date - involvement: Vehicle[]

Given the following UML diagram:

Part 1: Implement the following classes: Check the notes below before you start:

AccidentReport

- date: Date

- involvement: Vehicle[]

- nbOfVehicle: int

+ AccidentReport ()

+ getDate ():Date

+ addNewVehicle(v: Vehicle): void

+ cruiserMotoInvolved():boolean

+ countAutomaticCars():int

+ displayOwners(): void

Vehicle

- owner:String

- matriculation: String

- model: String

+ Vehicle (----All Parameters----)

+ setters/getters

+ toString(): String

Motorcycle

- torque: double

- type: String // standard, cruiser or sport

+ Motorcycle (----All Parameters----)

+ setter/getter

+ toString(): String

Car

- horsePower: int

- automatic: boolean

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

+ setter/getter

+ toString(): String

Notes:

  1. The Vehicle class: (10pts)

    1. The ToString method should return a String similar to :

Model: BMW, Owner: Ali Moussa, Matriculation: S1234

  1. The car class: (10pts)

    1. The ToString method should return a String similar to :

Car : BMW, Owner: Ali Moussa, Matriculation: S1234, Automatic, 255 hp

OR

Car: BMW, Owner: Ali Moussa, Matriculation: S1234, Manual, 255 hp

  1. The motorcycle class: (10pts)

    1. The toString method should return a String similar to:

Sport Motorcycle: BMW, Owner: Ali Moussa, Matriculation: S1234, 50 N

  1. The AccidentReport class: : (50pts)

    1. The involvement array can have at most 10 elements.

    2. The date data field should include the current date (exact date of object creation)

    3. The nbOfVehicle should register the real number of involved Vehicle (how many elements has been added to the array).

    4. The AccidentReport () constructor will create an object with the current date, involvement array of size 10 and nbOfVehicle equal to zero.

    5. addNewVehicle(v: Vehicle) adds new Vehicle to the array (if the array is not full)

    6. cruiserMotoInvolved() returns true if a Motorcycle of type Cruiser has been involved in the accident. And false otherwise.(by searching the involvement array)

    7. countAutomaticCars() returns the number of automatic cars that has been involved in this accident. .(by searching the involvement array)

    8. displayOwners(): Display the names of owners of all involved Vehicles.

Part 2: Implement a driver class (main class) as follows: (20pts)

  1. Create an AccidentReport object.

  2. Add to the report object 2 Cars objects and 1 Motorcycle of your choice.

  3. Add to the report object one automatic Car of Model BMW horsepower equal to 600 owned by oussama atwi and has matriculation nb S123123.

  4. Display the number of automatic cars involved in this report.

  5. Display if any cruiser motorcycle has been involved.

  6. Display all Owners names.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

What are the logistics implications of internationalisation?

Answered: 1 week ago