****APP #include "vehicle.h" #include "truck.h" #include "sportscar.h" #include using namespace std; int main () { Sportscar nissan; cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << endl; cout << "Nissan Silvia 15 (S15) Info" << endl; nissan.set_time(5.52); nissan.set_weight(2500); nissan.set_year(1999); nissan.set_license_no("SR20DET"); nissan.display(); cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << endl; cout << endl << endl << endl; Truck ford_lightning; cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << endl; cout << "Ford Lightning 2004" << endl; ford_lightning.set_load(1400); ford_lightning.set_weight(5450); ford_lightning.set_year(2003); ford_lightning.set_license_no("USMUSLE"); ford_lightning.display(); cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << endl; return 0; } ***SPORTS #include #include #include "Sportscar.h" using namespace std; Sportscar::Sportscar() { int year = 0; double weight = 0.0; } Sportscar::Sportscar(int year, double weight) { } Sportscar::~Sportscar() { cout << "Sportscar's Destructor Called\n"; } void Sportscar::display() { cout << "0-60 mph in : " << get_time() << "s" << endl; cout << "Year : " << get_year() << endl; cout << "Weight : " << get_weight() << "lbs" << endl; cout << "License: " << get_license_no() << " CALIFORNIA PLATE" << endl; /* Vehicle::honk() Cannot be called because private functions of base classes cannot be called by ANY Descendants*/ } void Sportscar::set_time( double make_time) { time_x = make_time; } double Sportscar::get_time() { return time_x; } **TRUCK #include #include #include "truck.h" using namespace std; Truck::Truck() { int year = 0; double weight = 0.0; cout << "Truck default" << endl; } Truck::Truck(int year, double weight) { cout << "Truck 2 parameter" << endl; } Truck::~Truck() { cout << "Truck's Destructor Called\n"; } void Truck::set_load( double pload) { pay_load = pload; } double Truck::get_load() { return pay_load; } /*double Truck::get_load(double pload) { return pay_load; } void Truck::set_load( double pay_load) { pay_load = pload; } */ void Truck::display() { cout << "Weight : " << get_weight() << " lbs." << endl; cout << "Pay load Capacity is : " << get_load() << " lbs in cab" << endl; cout << "Year : " << get_year() << endl; // cout << "Weight : " << get_weight() << endl; cout << "License: " << get_license_no() << endl; } **Vehicle #include "Vehicle.h" #include "Truck.h" #include "Sportscar.h" Vehicle::Vehicle() : weight(0), year(0) { cout << "Vehicle's Constructor Called\n"; } Vehicle::~Vehicle() { cout << "Vehicle's Destructor Called\n"; } void Vehicle::display() { cout << "\nWeight : " << weight << " lbs." << "\nYear : " << year << "\nLicense: " << license_plate_no << endl; } void Vehicle::set_license_no(string the_license) { license_plate_no = the_license; } void Vehicle::set_weight(double the_weight) { weight = the_weight; } void Vehicle::set_year(int the_year) { year = the_year; } double Vehicle::get_weight() { return weight; } int Vehicle::get_year() { return year; } string Vehicle::get_license_no() { return license_plate_no; } void Vehicle::honk() { cout << "HONK!\n"; } ________HEADER *Sport #ifndef SPORTSCAR_H #define SPORTSCAR_H #include #include #include "vehicle.h" using namespace std; class Sportscar : public Vehicle { public: Sportscar(); Sportscar(int, double); ~Sportscar(); double get_time(); void set_time(double make_time); void display(); private: double time_x; }; #endif *Truck #ifndef TRUCK_H #define TRUCK_H #include #include #include "vehicle.h" using namespace std; class Truck : public Vehicle { public : Truck(); Truck(int, double); ~Truck(); double get_load(); void display(); void set_load(double); double pload; private: double pay_load; }; #endif *Vehcile #ifndef VEHICLE_H #define VEHICLE_H #include #include //#include "Truck.h" //#include "Sportscar.h" using namespace std; class Vehicle { private: double weight; //in lbs. int year; string license_plate_no; void honk(); public: Vehicle(); Vehicle(double weight, int year); ~Vehicle(); void set_weight(double the_weight); double get_weight(); void set_year(int the_year); int get_year(); void set_license_no(string the_licence); string get_license_no(); void display(); //displays all the vehicle's info to the screen }; #endif