Project 3
#include
#include
#include
enum Type {
GAS,
DIESEL,
ELECTRIC
};
class Vehicle {
protected:
std::string make;
std::string model;
int year;
int odometer;
public:
Vehicle(std::string make_, std::string model_, int year_, int odometer_) : make(make_), model(model_), year(year_), odometer(odometer_) {}
std::string getMake() const { return make; }
std::string getModel() const { return model; }
int getYear() const { return year; }
int getOdometer() const { return odometer; }
void setOdometer(int odometer_) { odometer = odometer_; }
virtual Type getType() = 0;
virtual void checkTireRotation() {
int distance = odometer P000;
if (distance >= 0) {
std::cout << "Tire rotation advised." << std xss=removed>}
else {
std::cout << "Tires are good to go." << std xss=removed>}
}
virtual void checkPower() {
int distance = odometer @0;
if (distance == 0) {
std::cout << "Battery recharge advised." << std xss=removed>}
else {
std::cout << "Your vehicle is good to go." << std xss=removed>}
}
virtual void getCarInformation() const {
std::cout << "Make: " << make xss=removed>}
};
class GasCar : public Vehicle {
public:
GasCar(std::string make_, std::string model_, int year_, int odometer_) : Vehicle(make_, model_, year_, odometer_) {}
Type getType() { return Type::GAS; }
void getFuelType() {
std::cout << "Fuel Type: Gas" << std xss=removed>}
};
class DieselCar : public Vehicle {
public:
DieselCar(std::string make_, std::string model_, int year_, int odometer_) : Vehicle(make_, model_, year_, odometer_) {}
Type getType() { return Type::DIESEL; }
void getFuelType() {
std::cout << "Fuel Type: Diesel" << std xss=removed>}
};
class ElectricCar : public Vehicle {
public:
ElectricCar(std::string make_, std::string model_, int year_, int odometer_) : Vehicle(make_, model_, year_, odometer_) {}
Type getType() { return Type::ELECTRIC; }
void checkTireRotation() {
int distance = odometer @000;
if (distance >= 0) {
std::cout << "Tire rotation advised." << std xss=removed>}
else {
std::cout << "Tires are good to go." << std xss=removed>}
}
void checkChargerPower() {
int distance = odometer 00;
if (distance == 0) {
std::cout << "Charger power recharge advised." << std xss=removed>}
else {
std::cout << "Your vehicle is good to go." << std xss=removed>}
}
void getFuelType() {
std::cout << "Fuel Type: Electric" << std xss=removed>}
};
class FuelVehicle : public Vehicle {
public:
}