Define classes Auto, Tank and Date to model an automobile with ID number, odometer, manufacture date, purchase date, miles per gallon, and fuel level, with a driver to test the contructors, >>, <<, and fillUp and drive functions, which fill the tank and drive the car respectively.

What will be an ideal response?

```
class Date {
public:
Date() {} // default constructor
Date(int, int, int); // initializing constructor
int getMonth() const; // accessor
int getDay() const; // accessor
int getYear() const; // accessor
private:
int month, day, year;
friend istream& operator>> (istream&, Date&);
};
class Tank {
public:
Tank() {} // default constructor
Tank(double, double); // initializing constructor
double fillUp(); // fills tank and reports # gallons needed
void decrease(double); // decreases level in tank
double getCapacity() const; // accessor
double getCurrent() const; // accessor
private:
double capacity, current;
friend istream& operator>> (istream&, Tank&);
};
class Auto {
public:
Auto() {} // default constructor
Auto(int, int, const Date, const Date, double, const Tank);
// constructor with component classes
Auto(int, int, int,int,int, int,int,int, double, double, double);
// constructor with all component values
void drive(int); // adjust fuel and odometer for given miles
double fillUpTank(); // fill the tank up
private:
int ID, odometer;
Date manufacture, purchase;
double mpg;
Tank fueltank;
friend istream& operator>> (istream&, Auto&);
friend ostream& operator<< (ostream&, const Auto&);
};
```

Computer Science & Information Technology

You might also like to view...

The box-shadow style was originally introduced as a browser extension under Mozilla and WebKit.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Data analysis certifications often contain the word ______ in their title.

A. reasoning B. forensics C. inquiry D. investigation

Computer Science & Information Technology