Question: UML Object Models: Aggregation, and Composition Example 3: Car name: string -id:string -seatNb : int -year: int |-ncel : int +Carin n : string, in

UML Object Models: Aggregation, and Composition Example 3: Car name: string -id:string -seatNb : int -year: int |-ncel : int +Carin n : string, in d:string, in s : int, in y:int, in size : int) +display) +isFull): bool +copyCar(in ca : Car) |+addElementinel : CarElements): bool |+PriceCar(): double ..(in ..........) CarElements |-code: string -price: double +CarElements(inc: string, in p: double) +CarElement(in E: CarElements) +display KsuCars -nbc : int +KsuCars(in size : int) +display() +isEmpty(): bool + searchCarin ce : string): int +getCarin nm: string): Car +AveragePrice(in y:int): double +..........(in ........) +remove(in s:string): bool KSU-CCIS-CS Question: Implement all the classes with all their methods using the following descriptions. Description of the different classes: Class Car Elements: The method display O 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 ncel : number of CarElements object currently in an object of the class 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: nbc number of Car currently in an object of the class KsuCar. 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
