Question: C++ --------------------------------------- Problem: Besides the main function, there are four classes in this assignment. Vehicle ( base class ), Car, Plane, and Rocket ( 3

C++

---------------------------------------

Problem: Besides the main function, there are four classes in this assignment. Vehicle (base class), Car, Plane, and Rocket (3 Child Classes). You will be given a text file that contains the information needed for the assorted instances of each class. You must read the text file content and assign values to specific class instances. Finally, you will output class instances data to the screen.

You will be reading your arguments from the command line. The name of the input file will be passed into your program as argument 1, argv[1]. The number of objects of type Car will be passed into your program as argument 2, argv[2]. The number of objects of type Plane will be passed into your program as argument 3, argv[3]. And the number of objects of type Rocket will be passed into your program as argument 4, argv[4] .

Text File Descriptions: The text file will contain detailed information for each object. The number of objects of each type will be passed in, which will be consistent with given information in text files content. For example, if total number of objects of all types is 8, there will be total 8 lines in the text files content. Moreover, detailed information of each object will be given in order. The file will contain information in the following order: all objects of type Car, followed by objects of type Plane, and finally followed by objects of type Rocket.

For example: ./hw4.out inputInfo.txt 3 2 2

C++ --------------------------------------- Problem: Besides the main function, there are four classes in

Below are the blueprints for the order that information for each object will occur in the input file:

Car:

(each attributes value will be separated by a single space, and is a single word (when applicable))

this assignment. Vehicle (base class), Car, Plane, and Rocket (3 Child Classes).

Plane:

(each attributes value will be separated by a single space, and is a single word (when applicable))

You will be given a text file that contains the information needed

Rocket:

(each attributes value will be separated by a single space, and is a single word (when applicable))

for the assorted instances of each class. You must read the text

(manu is short for manufacturer)

Details: You will be given the prototype of each class (.h files). You are NOT allowed to change any function name/attribute name, or remove any functions from the .h files. Some functions may not end up being used, but they should be defined/implemented anyway. The purpose of those functions is to help you understand how classes will be implemented and provide access interfaces. (0 points if any are changed)

You will also be given the main function, and prototypes of some other functions to be defined in hw4.cpp and used in main. You are NOT allowed to change any function name/variable name, or remove any functions. (0 points if any are changed)

You ARE allowed to create and use additional functions if you choose to do so. If you find that you are duplicating large chunks of code, we highly recommend that you define a function to perform that specific task instead of repeating it over and over.

hw4.cpp: Main Function

file content and assign values to specific class instances. Finally, you will

Functions to be created in hw4.cpp and used within main function:

output class instances data to the screen. You will be reading your

Prototypes for class Vehicle, class Car, class Plane, class Rocket (.h files)

Vehicle.h:

arguments from the command line. The name of the input file will

Car.h:

be passed into your program as argument 1, argv[1]. The number of

Plane.h:

objects of type Car will be passed into your program as argument

Rocket.h:

2, argv[2]. The number of objects of type Plane will be passed

Homework 4 COSC 1430 Inheritance & Polymorphism Due Sunday 10/22/2017 at 11:59PM

Sample Input:

./hw4.out inputInfo.txt 1 1 1

inputInfo.txt:

into your program as argument 3, argv[3]. And the number of objects

Sample Output: Display on Screen, cout

of type Rocket will be passed into your program as argument 4,

Everyones output MUST match this exactly, every character. This is automatically graded by a computer program.

Submission:

- Place your hw4.cpp, Vehicle.cpp, Vehicle.h, Car.h, Car.cpp, Plane.h, Plane.cpp, Rocket.h, and Rocket.cpp files in the Linux server in your hw4 folder. If your files are not named exactly that, you will get 0 points.

- Compile your program, using the g++ command, and name your executable hw4.out

g++ -std=c++11 -o hw4.out *.cpp

Note/ Hint:

- You must use command line arguments for this assignment.

- You are NOT allowed to change anything in given codes (0 points if not followed)

- You MUST use Inheritance to implement the relationships between Vehicle, Car, Plane, and Rocket. (0 points if not followed)

- You MUST apply polymorphism to use the print() function from a child/derived class. (0 points if not followed)

- USE GOOGLE! (Seriously)

- USE StackOverflow

Honda Accord 4 V6 Honda 250 1500 155 White 4 100 4 Honda Civic 4 V6 Honda 300 1700 180 Black 2 12350 4 Porsche 911 4 V6 Porsche 400 2000 220 White 2 1210 4 Boing787 4 Jetliner Rolls-Royce 10000 500 593 3 197 Commercial 350 Boing777 4 Jetliner Rolls-Royce 7500 420 500 3 180 Commercial 310 12 TBA TBA 2500 20000 1000 0 1 10000 8 TBA TBA 1900 17500 85000 7500 Honda Accord 4 V6 Honda 250 1500 155 White 4 100 4 Honda Civic 4 V6 Honda 300 1700 180 Black 2 12350 4 Porsche 911 4 V6 Porsche 400 2000 220 White 2 1210 4 Boing787 4 Jetliner Rolls-Royce 10000 500 593 3 197 Commercial 350 Boing777 4 Jetliner Rolls-Royce 7500 420 500 3 180 Commercial 310 12 TBA TBA 2500 20000 1000 0 1 10000 8 TBA TBA 1900 17500 85000 7500

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!