2022 10 03

// File name: Car.h
// The class definition for the Car class

#ifndef CAR_H
#define CAR_H

class Car{
    // declare my class data members
    private;
        string make; // represents the make
        string model; // represents the model
        int year; // represents the year of the model
        double MPG; // represents the miles per galon
        string int_color;
        string ext_color;
    //deflare our class member function
    public;
        Car(); // default constructor
        Car(string ma, string mod, int y, double m, string ic, string ec); // parameter constructor
        ~Car(); // destructor
        void print() const; // print car information
        bool better_mpg(Car b); // return true if mpg is better
        void set_extColor(string newColor); // change exterior color
}
// File name: Car.cpp
// Definition of all Car Member Functions

#include "Car.h"
#include <iostream>

using namespace std;

// define constructors
// The default constructor just sets all data members to chosen default values
Car::Car():make(""),model(""),year(0),MPG(0),int_color(""),ext_color(""){}

// parameter constructor
// sets all data members equal to the parameter values
Car::Car(string make, string model, int y, double m, string ic, string ec){
    this->make = make; // sets the data member make equal to the parameter make
    this->model = model;
    year = y;
    MPG = m;
    int_color = ic;
    ext_color = ec:
}

//destructor
Car::~Car(){}

// print information about the car
void Car::print(){
    cout << "\tMake: " << make << "\n";
    cout << "\tModel: " << model << "\n";
    cout << "\tYear: " << year << "\n";
    cout << "\tEstimated MPG: " << mpg << "\n";
    cout << "\tInterior Color: " << int_color << "\n";
    cout << "\tExterior Color: " << ext_color << "\n";
}

//return true if the instance object has better mpg than the parameter object
bool Car::better_mpg{
    // the parameter Car b is a completely different Car object with its own data members
    // to access the MPG associated with the b object, use: b.MPG
    if(this->MPG > b.MPG)
        return true;
    else
        return false;
}

void Car::set_extColor(string newColor){
    ext_color = newColor;
}