A car dealership needs a program to store information about the cars for sale. F
ID: 3581200 • Letter: A
Question
A car dealership needs a program to store information about the cars for sale. For Bach car, they want to keep track of the following information: number of doors (2 pr 4), whether the car has air conditioning, and its average number of miles per gallon. Which of the following is the best design? which has three data fields: nt numDoors, boolean has Air, and double mile Use one class, Ca PerGallon O Use four unrelated classes: Car, Doors, AirConditioning, and MilesPerGallon O Use a class Car which has three subclasses. Doors, ArConditioning and MilesPerGallon O Use a class Ca which has a subclass Doors, which a subclassAirConditioning, with a subclass MilesPerGalon O Use three classes. Doors, Airconditioning, and MilesperGallon, each with a subclass Car. aExplanation / Answer
Answer :
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?
Answer :
Use one class Car, which has three data fields:int numDoors, boolean hasAir, and double milesPerGallon
Explanation :
This is the best design for above requirement i,e. Use one class Car, which has three data fields:int numDoors, boolean hasAir, and double milesPerGallon.
Note :There is no justifiable need to have more than 1 class in this situation.
........................
.................
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.