Please written by computer source  What will the application do? Display a set of at least 6 cars (at least 3 new and 3 used) along with Add and Quit options Let the user select one of the cars. Ask if they want to buy the car. If they enter yes, remove it from the list. If they want to add another car to the list, get the details, create a new instance of the appropriate class (Car class for new cars, or UsedCar), and add it to your data collection. Keep looping until they choose to quit.   Build Specifications If your instructors tells you to work in pairs, stay with your assigned pair for this lab. Create a class named Car to store the data about a car. This class should contain:Data members for car details A string for the make A string for the model An int for the year A decimal for the price A no-arguments constructor that sets data members to default values (blanks or your choice) A constructor with four arguments matching the order above Properties for all data members An override to the ToString() method returning a formatted string with the car details. Create a subclass of Car named UsedCar. UsedCar has additional members: Data member: A double for mileage. Constructor: Takes five arguments (same order as constructor from last lab with the mileage last). ToString: overrides Car’s ToString() to include (Used) and the mileage. Discuss with your partner how to store the car information. In what cases would each of these make more sense (if at all)? A variable that’s a two-dimensional array of cars A variable that’s a List A variable that’s a Dictionary Any other option? However you store the information, you should include methods to Add a car List all cars to the console Remove a car

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

Please written by computer source 

What will the application do?

Display a set of at least 6 cars (at least 3 new and 3 used) along with Add and Quit options

Let the user select one of the cars.

Ask if they want to buy the car. If they enter yes, remove it from the list.

If they want to add another car to the list, get the details, create a new instance of the appropriate class (Car class for new cars, or UsedCar), and add it to your data collection.

Keep looping until they choose to quit.

 

Build Specifications

If your instructors tells you to work in pairs, stay with your assigned pair for this lab.

Create a class named Car to store the data about a car. This class should contain:Data members for car details

A string for the make

A string for the model

An int for the year

A decimal for the price

A no-arguments constructor that sets data members to default values (blanks or your choice)

A constructor with four arguments matching the order above

Properties for all data members

An override to the ToString() method returning a formatted string with the car details.

Create a subclass of Car named UsedCar. UsedCar has additional members:

Data member: A double for mileage.

Constructor: Takes five arguments (same order as constructor from last lab with the mileage last).

ToString: overrides Car’s ToString() to include (Used) and the mileage.

Discuss with your partner how to store the car information. In what cases would each of these make more sense (if at all)?

A variable that’s a two-dimensional array of cars

A variable that’s a List<Car>

A variable that’s a Dictionary <?, Car>

Any other option?

However you store the information, you should include methods to

Add a car

List all cars to the console

Remove a car

Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Study of Characters
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage