Respuesta :
The best object-oriented program design for this car dealership's software program is to use a single class Car, with three instance variables (fields):
- numDoors
- hasAir
- milesPerGallon.
What is a class?
A class can be defined as a user-defined blueprint (prototype) or template that is typically used by software programmers to create objects and define the data types, categories, and methods that should be associated with these objects.
In object-oriented programming (OOP) language, a class that is written or created to implement an interface in a software would most likely implement all of that interface's method declarations without any coding error.
In this scenario, the best object-oriented program design for this car dealership's software program is to use a single class Car, with three instance variables (fields):
- int numDoors
- boolean hasAir
- double milesPerGallon.
Read more on class here: brainly.com/question/20264183
#SPJ1
Complete Question:
A car dealership needs a program to store information about the cars for sale. For each car, they want to keep track of the following information: number of doors (2 or 4), whether the car has air conditioning, and its average number of miles per gallon. Which of the following is the best design?
(A) Use four unrelated classes: Car, Doors, AirConditioning, and MilesPerGallon.
(B) Use a class Car with three subclasses: Doors, AirConditioning, and MilesPerGallon.
(C) Use a class Car, with fields: numDoors, hasAir, and milesPerGallon.
(D) Use a class Car, with subclasses of Doors, AirConditioning, and MilesPerGallon.
(E) Use classes: Doors, AirConditioning, and MilesPerGallon, each with a subclass Car.