Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java Eription... eservices Q1 (15 Marks): CLO 1, CLO 3 Use the following UML to Car class. Study the UML and the Instructions below:

image text in transcribedin java

Eription... eservices Q1 (15 Marks): CLO 1, CLO 3 Use the following UML to Car class. Study the UML and the Instructions below: PART 1: Class Car: A. Non-Static attributes are: Car 1. brand. 2. model. brand : String 3. releasedYear. model: String 4. IsPreOwned. releasedYear : Int 5. numOfPreOwners: represents the number of the Pre-Owners IsPreOwned: boolean who owned the car. numOfPreOwners : Int 6. preOwnersArray: is an array to save the Pre-Owners names preOwnersArray : String [10] who owned the car. It has a fixed size which is 10, so the used CarCount : static int maximum number of Pre-Owners are 10. Car (String, String, int) addPreOwner (String) : vold B. Static attributes are: getPreOwnersString 0 : string 1. usedCarCount: count the number of used cars. getUsed CarCount(): static int print (): vold printAllDetails (void C. Methods: 1. Car (String, String, int): Set parameters to the attributes: brand, model, release Year. Set isPreOwned to false. Set numOfPreOwners to Zero. 2. addPreOwner (String): The parameter is a String represents the Pre-Owner name to be added to the preOwnersArray Check the numOfPreOwners before adding to array. If the numOfPreOwners is 10 print, print an error message to the user. Else: Check the isPreOwned, if its value is false:change isPreOwned to true, and increament usedCarCount by One. However, Increament the numOfPreOwners by one. getPreOwnersString(): Use numOfPreOwners to return the Pre-Owners names that added to the array preOwnersArray. The value returned is a single string that separate the names by COMMAS. (example: Ahmed Kamal, Rami Salem) 4. getUsed CarCount() return usedCarCount. 5. print 0 print the non static attributes: brand, model, releasedYear & IsPreOwned. Print it in an appropriate format. 6. printAll Details 0) . call print method. print the String returned from getPreOwnersString. This prints the Pre-Owners names added to the array preOwnersArray . . . PART 2: Class Test (that include the main method for testing, NOT A GUI): Car Brand 1 BMW 2 Toyota Honda Model 470 Camry Arround Released Year 2020 2015 2019 Pre-Owners

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_2

Step: 3

blur-text-image_3

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

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions