Suppose we are developing a program that a car dealership can use to manage its inventory of used cars. The dealership’s inventory includes three types of automobiles: cars, pickup trucks, and sport-utility vehicles (SUVs). Regardless of the type, the dealership keeps the following data about each automobile: Make Year model Mileage Price Each type of vehicle that is kept in inventory has these general characteristics, plus its own specialized characteristics. For cars, the dealership keeps the following additional data: Number of doors (2 or 4) For pickup trucks, the dealership keeps the following additional data: Drive type (two-wheel drive or four-wheel drive) And, for SUVs, the dealership keeps the following additional data: Passenger capacity In designing this program, one approach would be to write the following three classes: A Car class with attributes for the make, year model, mileage, price, and number of doors. A Truck class with attributes for the make, year model, mileage, price, and drive type. An SUV class with attributes for the make, year model, mileage, price, and passenger capacity. This would be an inefficient approach, however, because all three classes have a large number of common data attributes. As a result, the classes would contain a lot of duplicated code. In addition, if we discover later that we need to add more common attributes, we would have to modify all three classes. A better approach would be to write an Automobile base/Parent class to hold all the general data about an automobile, and then write derived classes (Car, PickUpTruck, SUV which extends the Parent Class automobile) for each specific type of automobile. Create an Automobile class with above attributes, Provide getter, setters, constructors and toString method. Write a class Car which extends Automobile class with attribute noOfDoors, provide default and parameterized constructor (with super keyword set values of parent’s attributes), getters, setters, and toString method. Write a class PickUpTruck which extends Automobile class with attribute driveType, provide default and parameterized constructor (with super keyword set values of parent’s attributes), getters, setters, and toString method. Write a class SUV which extends Automobile class with attribute passengerCapacity, provide default and parameterized constructor (with super keyword set values of parent’s attributes), getters, setters, and toString method. Now in the main you have to create objects of three types of automobiles using parametrized constructor and print their values. i want this program in java language...kindly do the program according to above requirements

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Suppose we are developing a program that a car dealership can use to manage its inventory of used cars. The dealership’s inventory includes three types of automobiles: cars, pickup trucks, and sport-utility vehicles (SUVs).

Regardless of the type, the dealership keeps the following data about each automobile:

  • Make
  • Year model
  • Mileage
  • Price

Each type of vehicle that is kept in inventory has these general characteristics, plus its own specialized characteristics. For cars, the dealership keeps the following additional data:

  • Number of doors (2 or 4)

For pickup trucks, the dealership keeps the following additional data:

  • Drive type (two-wheel drive or four-wheel drive)

And, for SUVs, the dealership keeps the following additional data:

  • Passenger capacity

In designing this program, one approach would be to write the following three classes:

  • A Car class with attributes for the make, year model, mileage, price, and number of doors.
  • A Truck class with attributes for the make, year model, mileage, price, and drive type.
  • An SUV class with attributes for the make, year model, mileage, price, and passenger capacity.

This would be an inefficient approach, however, because all three classes have a large number of common data attributes. As a result, the classes would contain a lot of duplicated code. In addition, if we discover later that we need to add more common attributes, we would have to modify all three classes.

A better approach would be to write an Automobile base/Parent class to hold all the general data about an automobile, and then write derived classes (Car, PickUpTruck, SUV which extends the Parent Class automobile) for each specific type of automobile.

Create an Automobile class with above attributes, Provide getter, setters, constructors and toString method.

Write a class Car which extends Automobile class with attribute noOfDoors, provide default and parameterized constructor (with super keyword set values of parent’s attributes), getters, setters, and toString method.

Write a class PickUpTruck which extends Automobile class with attribute driveType, provide default and parameterized constructor (with super keyword set values of parent’s attributes), getters, setters, and toString method.

Write a class SUV which extends Automobile class with attribute passengerCapacity, provide default and parameterized constructor (with super keyword set values of parent’s attributes), getters, setters, and toString method.

Now in the main you have to create objects of three types of automobiles using parametrized constructor and print their values.

i want this program in java language...kindly do the program according to above requirements

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Reference Types in Function
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education