A good answer might be:

You would expect to use:

  1. Starting odometer reading,
  2. Ending odometer reading, and
  3. Gallons of gas used between the readings.

Specifications for the Car class

Professional programmers carefully design the classes they need before any coding is done. With well-designed classes programming is much easier and the program has fewer bugs. Object oriented design consists of deciding what classes are needed, what data they will hold, and how they will behave. All these decisions are documented (written up) and then examined. If something doesn't look right, it is fixed before any programming is done. Let us do that with our Car class.


Car

A class that calculates miles per gallon.

Variables

Constructors

Methods

Look at the parameter list for the constructor:

int startOdo, int endingOdo, double gallons

This says that the constructor must be called with three items of data: an int, another int, and a double. The items must occur in that order.

QUESTION 2:

Could a main() method create a Car object?