CarType enum Create an enumeration named CarType to represent the types of cars as follows: ...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
CarType enum Create an enumeration named CarType to represent the types of cars as follows: • SUV Hatchback Sedan Truck Car Class This class consists of the following members. All the properties have public getters and no setters. manufacturer : string o A string property to store manufacturer name such as "Honda" make : int o An int property to store the making year of car such as 2018 model : string o A string property to store the model's name of the case such as "Civic" VI_NUMBER : int = 1001 o This is a static field to create unique Vehicle Identification Number for each car object. This number should be automatically incremented by 100 each time the constructor of this class is called. This field will be used to initialize the VIN field. VIN: int o This field represents unique Vehicle Identification Number for each car object which will be initialized from VI_NUMBER field. basePrice : double o This property stores the base price of the car such as $35000.00 type : carType o This property stores type of the car such as Sedan. It must receive value of the CarType enumeration. Define the following constructors for this class: • Car (string manufacturer, int make, string model, double basePrice, CarType type) o This constructor will assign received parameters to the respective class properties o It should also increment VIN by 10 Implement the following methods in the class: • override string toString() o this method should display all the car details in appropriate format. Dealership class This class consists of the following members. All the properties have public getters and no setters. • carList : ArrayList<Car> o This is a static property that holds a list of car objects that dealership has in stock. • id: string o A string property to store ID of each dealership such as "D22_101" name: string o A string property to store name of the dealership such as "The Six Dealership" address: string o A string property to store the address of dealership such as "1029 Main Street, Toronto" Define the following constructors for this class: • Dealership (string ID, string name, string address) o This constructor will assign received parameters to the respective class properties Implement the following methods in the class: • void addCar(string manufacturer, int make, string model, double basePrice, CarType type) o this method will create a car object using provided parameters and add the car object in the carlist array. void showCars(String manufacturer) o this method will display all the cars for which the manufacturer is same as the given parameter. o For example, showCars("Toyota") will show all the cars from carList property that has Toyota as manufacturer. void showCars(string manufacturer, int make) o this method will display all the cars for which the manufacturer and make is same as the given parameters. o For example, showCars("Toyota", 2018) will show all the cars from carlist property that has Toyota as manufacturer and make in 2018. void showCars(string manufacturer, int make, double base Price) o this method will display all the cars for which the manufacturer and make is same as the given parameters as well as basePrice which is NOT more than given parameter value. o For example, showCars("Toyota", 2018, 10000) will show all the cars from carList property that has Toyota as manufacturer, make in 2018 and basePrice not more than 10000. override string toString() o this method should display all the dealership details in appropriate format. Test Class To test the above-mentioned classes, create a class named CarTest.java. This class will contain the main() method that should perform the following operations: o Create at least 2 carDealership objects o For each of the objects, create and add at least 3 car objects in the array, call the showCars() method with different parameters and/or values to demonstrate method overloading. CarType enum Create an enumeration named CarType to represent the types of cars as follows: • SUV Hatchback Sedan Truck Car Class This class consists of the following members. All the properties have public getters and no setters. manufacturer : string o A string property to store manufacturer name such as "Honda" make : int o An int property to store the making year of car such as 2018 model : string o A string property to store the model's name of the case such as "Civic" VI_NUMBER : int = 1001 o This is a static field to create unique Vehicle Identification Number for each car object. This number should be automatically incremented by 100 each time the constructor of this class is called. This field will be used to initialize the VIN field. VIN: int o This field represents unique Vehicle Identification Number for each car object which will be initialized from VI_NUMBER field. basePrice : double o This property stores the base price of the car such as $35000.00 type : carType o This property stores type of the car such as Sedan. It must receive value of the CarType enumeration. Define the following constructors for this class: • Car (string manufacturer, int make, string model, double basePrice, CarType type) o This constructor will assign received parameters to the respective class properties o It should also increment VIN by 10 Implement the following methods in the class: • override string toString() o this method should display all the car details in appropriate format. Dealership class This class consists of the following members. All the properties have public getters and no setters. • carList : ArrayList<Car> o This is a static property that holds a list of car objects that dealership has in stock. • id: string o A string property to store ID of each dealership such as "D22_101" name: string o A string property to store name of the dealership such as "The Six Dealership" address: string o A string property to store the address of dealership such as "1029 Main Street, Toronto" Define the following constructors for this class: • Dealership (string ID, string name, string address) o This constructor will assign received parameters to the respective class properties Implement the following methods in the class: • void addCar(string manufacturer, int make, string model, double basePrice, CarType type) o this method will create a car object using provided parameters and add the car object in the carlist array. void showCars(String manufacturer) o this method will display all the cars for which the manufacturer is same as the given parameter. o For example, showCars("Toyota") will show all the cars from carList property that has Toyota as manufacturer. void showCars(string manufacturer, int make) o this method will display all the cars for which the manufacturer and make is same as the given parameters. o For example, showCars("Toyota", 2018) will show all the cars from carlist property that has Toyota as manufacturer and make in 2018. void showCars(string manufacturer, int make, double base Price) o this method will display all the cars for which the manufacturer and make is same as the given parameters as well as basePrice which is NOT more than given parameter value. o For example, showCars("Toyota", 2018, 10000) will show all the cars from carList property that has Toyota as manufacturer, make in 2018 and basePrice not more than 10000. override string toString() o this method should display all the dealership details in appropriate format. Test Class To test the above-mentioned classes, create a class named CarTest.java. This class will contain the main() method that should perform the following operations: o Create at least 2 carDealership objects o For each of the objects, create and add at least 3 car objects in the array, call the showCars() method with different parameters and/or values to demonstrate method overloading.
Expert Answer:
Answer rating: 100% (QA)
Below is the implementation of the CarType enum Car class and Dealership class based on the provided ... View the full answer
Related Book For
An Introduction to Management Science Quantitative Approach to Decision Making
ISBN: 978-1337406529
15th edition
Authors: David R. Anderson, Dennis J. Sweeney, Thomas A. Williams, Jeffrey D. Camm, James J. Cochran
Posted Date:
Students also viewed these programming questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Show that in the limit ??x ?? 0 and ??t ?? 0, the difference Equation (3.12) is equivalent to the differential Equation (2.5). GIVENThe difference equation for one-dimensional transient...
-
What's the current yield of a 5.2 percent coupon corporate bond quoted at a price of 96.78?
-
How would you describe the principles, beliefs, and values at WestJet?
-
Estimate the overall odds ratio of the set of tables in Problem3.6 and test whether the odds ratios are the same across the tables. Problem3.6 is: 3.6 Use the DOS data to test whether there is gender...
-
Statement of Legal Debt Margin. In preparation for a proposed bond sale, the city manager of the City of Appleton requested that you prepare a statement of legal debt margin for the city as of...
-
Data Input Box: Number of mortgages in initial pool 500 Average mortgage balance $300,000 Initial mortgage pool balance $150,000,000 Prepayment rate 7.50% Mortgage rate 4.50% Servicing and Guarantee...
-
Your client, Summerford, Inc., has a debt agreement with Valley City Bank that includes a number of restrictions and covenants. Violation of any restriction or covenant results in the entire amount...
-
Suppose that I have an independent random sample of 42 people, where I ask them about their wages and years of experience. In my sample, the odd numbered people (i.e. the 1st, 3rd, 5th etc people I...
-
You would like to retire in 30 years and you have calculated that you will need to save $2 million dollars by then to retire comfortably. How much must you put into your retirement savings account at...
-
Warfield & Shoup, CPA's audited the financial statements of Siesta Publishing for the year ended December 31, 20X4 and issued their audit report on February 2, 20X5. After a dispute with the firm,...
-
mm 12-14. A rural community of 20,000 persons generates solid waste at an average rate of 7 lbs per person per day. A 20-acre landfill site (fill area) is available. The average depth of fill is...
-
This is an individual assignment so work submitted should be createddby you Submit java files and the output of the program by adding into word/pdf file onBlackBorad Late assignment will be penalized...
-
Why does FASB make things so complicated? Couldn't there just be one method for accounting for investments in other companies rather than three?
-
"Relationship, Responsibility and Accountability are 3 cornerstones of the CSR debate." With reference to learned theories and case study examples, please critically evaluate the above statement.
-
Catalytic hydrogenation of naphthalene over PdC results in rapid addition of 2 moles of H 2 . Propose a structure for this product.
-
South Central Airlines (SCA) operates a commuter flight between Atlanta and Charlotte. The regional jet holds 50 passengers, and currently SCA only books up to 50 reservations. Past data show that...
-
Gulf Coast Electronics is ready to award contracts to suppliers for providing reservoir capacitors for use in its electronic devices. For the past several years, Gulf Coast Electronics has relied on...
-
Davison Electronics manufactures two models of LCD televisions, identified as model A and model B. Each model has its lowest possible production cost when produced on Davisons new production line....
-
True or False: Engineers seldom have an opportunity to influence the recovery period for expenditures.
-
A lumber company purchases and installs a wood chipper for \(\$ 200,000\). The chipper is classified as MACRS 7-year property. Its useful life is 10 years. The estimated salvage value at the end of...
-
True or False: Straight-line depreciation is the most popular depreciation method used in financial reporting.
Study smarter with the SolutionInn App