Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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:

- engine to "Minn Kota Max 70"

- weight 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 section.

A default constructor that takes no arguments and sets the attributes to:

- engine to "V6"

- wheels to 4

- weight to 4079

- seats to 2

- make to "Toytoa"

- model to "Solara"

- A constructor that takes two string arguments that correspond to make and model in that order and one integer argument setting the number of wheels.

- Member functions to access and modify the attributes (seats, engine, wheels 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 automobile objects were created.

- An operator overload function that is a member function for the class for the = sign that will allow you to copy the information from one automobile object to another.

In your main.cpp you will need to create 3 objects of type watercraft, and 4 of type automobile. The first two watercraft objects will be created with the default constructor. Two objects of the type automobile will be created with the default constructor. The third automobile object should be created with the constructor that accepts three arguments, make, model, and wheels. Wheels should have a default value of 4 set if it is not provided in the constructor. Please refer to the example output files for values to use for make and model.

Watercraft object 3 and automobile object 4 should use the overloaded = to assign the information from the second object of each type. (ie boat3 = boat2 and car4 = car2)

The first object of each type contains the information for the default constructor. The second object of each has been modified via the mutators, and the third automobile has been created with the constructor that takes arguments for the make and model attributes.

The last two objects in the file are the result of using the overloaded = and should be identical to earlier objects.

You will also need to use three static member counters to keep track of how many objects are made. The last three lines of the output file reflect this. HINT: The static member variables need to be initialized outside of the main function before any objects are created.

image text in transcribed

image text in transcribed

image text in transcribed

that needs to be in file "out.txt"

image text in transcribed

image text in transcribed

Vehicles.h

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

Students also viewed these Databases questions

Question

Explain how EAP works.

Answered: 1 week ago

Question

What attracts you about this role?

Answered: 1 week ago

Question

How many states in India?

Answered: 1 week ago

Question

HOW IS MARKETING CHANGING WITH ARTIFITIAL INTELIGENCE

Answered: 1 week ago