Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ -------------------------------------------------- vehicles.h - #ifndef GA2_VEHICLES_H #define GA2_VEHICLES_H #include using namespace std; class vehicles { protected: string engine; int seats; int weight; public: vehicles(); static
C++
--------------------------------------------------
vehicles.h -
#ifndef GA2_VEHICLES_H #define GA2_VEHICLES_H #includeusing namespace std; class vehicles { protected: string engine; int seats; int weight; public: vehicles(); static int count; }; #endif //GA2_VEHICLES_H
-------------------------------------------------
Output Examples -
Watercraft: Engine: Minn Kota Max 70 Weight: 1860lbs Seats: 12 Hull: V - Hull Manufacturer: Sea Ark Boats Watercraft: Engine: Yamaha 115 HP Weight: 5200lbs Seats: 10 Hull: Fiberglass Manufacturer: Sea Ark Boats Automobile: Engine: V6 Wheels: 4 Weight: 4079lbs Seats: 2 Make: Toytoa Model: Solara Automobile: Engine: 3A90 I3 Wheels: 4 Weight: 2072lbs Seats: 5 Make: Mirage Model: Mitsubishi Automobile: Engine: V6 Wheels: 4 Weight: 4079lbs Seats: 2 Make: Honda Model: Accord Watercraft: Engine: Yamaha 115 HP Weight: 5200lbs Seats: 10 Hull: Fiberglass Manufacturer: Sea Ark Boats Automobile: Engine: 3A90 I3 Wheels: 4 Weight: 2072lbs Seats: 5 Make: Mirage Model: Mitsubishi Vehicles created: 7 Automobiles created: 4 Watercraft created: 3COSC 1430 - Group Assignment 2 Classes, Inheritance, Operator Overloading TO BE TURNED IN ON BLACKBOARD - 1 submission per group 1 - Objective Enhance the understanding of classes, inheritance, and operator overloading 2 - Problem Using the given class header file (vehicles.h), you will need to implement vehicles.cpp. Do not make any changes to vehicles.h From the vehicles class you will need to make two child classes, watercraft and automobile These should also be implemented using separate header and cpp files (e.g., watercraft.h watercraft.cpp, automobile.h, automobile.cpp) Your watercraft class must have the following Two additional attributes, hull and manufacture, in the private section. They should be of type string A default constructor that takes no arguments and sets the attributes to - -eneine to "Minn Kota Max 70" - eight to 1860 -hull to "V- Hull" - seats to 12 -manufacture to "Sea Ark Boats" Member functions to access and modify these attributes (i.e., seats, engine, hull, etc. must all be able to be changed by calling a member function) Print to file should take a string as an argument and be a member function. This should be the name of the file to be printed to, your default output file should be out.txt A static int counter that will be used to count how many watercraft objects were created An operator overloaded function that is a member function of the class for the "- sign that will allow you to copy the information from one watercraft object to another - Your automobile class must have the following Two additional attributes of type string, make and model, and one additional attribute of type int: wheels. All of them should be defined in the private
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started