Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Homework 1: the Association Concept (aggregation and composition) Given the following UML class diagram: name Carlements - Casing di yo bool Corina C -addrement Carmebol

image text in transcribed
image text in transcribed
image text in transcribed
Homework 1: the Association Concept (aggregation and composition) Given the following UML class diagram: name Carlements - Casing di yo bool Corina C -addrement Carmebol -PC -Creme po -CEE CE Kucars be |- -Empoo -Carince sing ring Ca gePriciny double removing tool Question: Implement all the classes with all their methods using the following descriptions. Description of the different classes: Class CarElements: The method display displays the code and the price. + ........ (in .........: if you need an other methods in this class you can add it. You can't add another constructor. Class Car: name id seatNb Number of seats year Production year of car And other attribute(s) deduced from the UML diagram. display 0: Displays all the attributes of an object Car. .addElement (CarElements el): This method receives a CarElements object and adds it to the Car object. priceCar(): Returns the sum of the CarElements price in an object of the class Car + ....... (in ........) : if you need an other methods in this class you can add it. Class KsuCars: And other attribute(s) deduced from the UML diagram. display 0: Displays all the attributes of an object KsuCars. search (String ce): This method receives a String representing the name of a Car object and returns the array index of the car object. .getCar (String nm): This method receives a String representing the id of a Car object and returns the Car object if it's exist. removeCar (String s): Removes a Car according to its name. It will return a value true if the operation has been completed successfully, or false if not. AveragePrice(int y): Calculates the average price of all car in an object of class KsuCars that produced after the year y. + ........ (in ........): if you need an other methods in this class you can add it. The main class: In the main you should be able to create a KsuCars with at least 3 cars. Each car has at least 4 car element. A display should be called to see all the entered data Car name : string -id:string -seatNb : int |-year: int -ncel : int +Carrin n string, in d: string, in sint, in y:int, in size : int) +display +isFull(): bool +copyCar(in ca: Car) +addElement(in el: CarElements): bool +PriceCar(): double CarElements -code: string -price: double +CarElements (in c: string, in p: double) +CarElement(in E: CarElements) +display() . KsuCars -nbc : int +KsuCars(in size : int) +display) +isEmpty(): bool +searchCar(in ce : string): int +getCar(in nm : string): Car +Average Price(iny:int)double +..............) +remove(ins: string): bool

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago