Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Program The Dealer class and the Car class (Filename: TestDealerCar.java) a. Design and implement a class named Car. A car has a serial number,

Java Program The Dealer class and the Car class (Filename: TestDealerCar.java)

a. Design and implement a class named Car. A car has a serial number, a make (such as Toyota), a model (such as Camry), a year built, and a price. The serial number of a new car is automatically created. It is one more than the last serial number used by the dealer. Create appropriate constructor(s) and accessor and mutator methods for the Car class.

b. Design and implement a class named CarDealer. A CarDealer has a name, the actual number of cars, and a list of cars (which is an array of Car objects. Assume that the maximum number of cars in a car dealer is 1000), and the actual number of cars. Create a constructor for creating a CarDealer object with a given name. Create a method for adding a car to a car dealer and another method for returning the array of all cars. Add another method to get the number of cars in a car dealer.

c. In the main method, create a new CarDealer object and create two cars. Add the two cars to the car dealer object. Get the list of cars from the CarDealer object and display their serial numbers, makes, types, years built, and prices.

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions