Problem of the Day
Monday, February 9, 2026
Problem:
Which of the following represent appropriate descriptions for a class designed to model cars?
| class | instance | accessor method | mutator method | |
| a. | Car | myCar | checkGasAmount | drive |
| b. | myCar | Car | checkGasAmount | drive |
| c. | Car | myCar | drive | checkGasAmount |
| d. | myCar | Car | drive | checkGasAmount |
The correct answer is a. Class names are typically capitalized, while objects (instances) of a class are not capitalized. The checkGasAmount, based on the method name, is intended simply to access the amount of gas in the car, while the drive presumably will use up gas in the car, changing its state (a mutator).