Please read the rules carefully Using namespace is a must Flowchart is needed 80
ID: 3704860 • Letter: P
Question
Please read the rules carefully Using namespace is a must Flowchart is needed80 Points Due 04/17/2018 04/05/2018 It is very important that you read the notes at the end of each assignment for this and all other assignments Make sure that you read related lessons, slides, the notes, and the sample programs. Study the exercises, and study program examples in the book. These are all prerequisites for better understanding of the classes, objects, and messages This assignment covers classes, and strings (refer to chapters 10, 11, 12, and 14 in the assigned text and the related sample programs and the notes discussed in the class). Enough flexibility are provided for you to apply your knowledge of the basic C++ programing to develop a solution with enough information and documentation as needed for this assignment. Develop the program model of the problem you are developing. This is different from the flowcharting you have been doing throughout the semester. Make sure the program model reflects the problem statement. You then need to develop a C++ program to solve the problem stated by you. Define a class Automobile with appropriate data member(s) and member functions (at least constructors and a destructor for each class.) Define the class Truck derived from the class Automobile that will add data members for the manufacturer and model year and member functions (at least constructors and destructor for the class.) Define the class SUV derived from the class Automobile that will add data members for the manufacturer and the color and member functions (at least constructors and destructor for the class.) You will create an object of the class Truck and an object of the class SUV using the default constructors and constructors with arguments. The default constructors initialize the two objects TI (Truck Object) and SI (SUV Object), An overloaded constructors will obtain the appropriate data from the keyboard and create objects T2 (Truck Objeet) and S2 (SUV Object). The program will then display the information using the function display Automobile) to display the information in the format shown below Manufacturer Model year Manufacturer Color Once the information is displayed, the program ends. Other member functions for the classes are defined by the programmer and as a minimum will include constructors, destructors, accessor, and mutating functions. User-defined functions will be used as needed to solve your problem This nroeram leaves out a few ontions for von to select
Explanation / Answer
#ifndef VEHICLE_H #define VEHICLE_H #include #include #include #include #include #include #include #include using namespace std; //Vehicle Class class Vehicle { protected: Vehicle myVehicle[9]; string make; //make string model; // model string color; // color int year; // year int mileage; string type; //Type of vehicle public: void New_vehicle (string a, string b, string c, int d, int e) {make = a; model = b; color = c; year = d; mileage = e;} Vehicle(); //Default constructor Vehicle(string, string, string, int, int, string); //mutator and accessor functions void setMake(string); void setModel(string); void setColor(string); void setYear(int); void setMileage(int); void setType(string); string getMake(); string getModel(); string getColor(); int getYear(); int getMileage(); string getType(); //Check mileage to see if valid void valid_mileage(int); //virtual function virtual void details() { }}; //Sets to default values Vehicle::Vehicle() { make = " "; model = " "; color = " "; year = 0; mileage = 0; type = " ";} Vehicle::Vehicle(string make, string model, string color, int year, int mileage, string type) { Vehicle::make = make; Vehicle::model = model; Vehicle::color = color; Vehicle::year = year; valid_mileage(mileage); Vehicle::type = type;} void Vehicle::setMake(string make) { Vehicle::make = make; } void Vehicle::setModel(string model) { Vehicle::model = model; } void Vehicle::setColor(string color) { Vehicle::color = color; } void Vehicle::setYear(int year) { Vehicle::year = year;} void Vehicle::setMileage(int mileage) { valid_mileage(mileage); } void Vehicle::setType(string type) { Vehicle::type = type; } #ifndef CAR_H #define CAR_H #include "Vehicle.h" //SUV class that inherits from the vehicle class class Car:public Vehicle { private: //There are no new attributes public: void details() { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.