Question: Create a problem in C++: Design a program that will read in 2 files (Cars.txt and detailReport.txt) and then will print out the output that

Create a problem in C++:

Design a program that will read in 2 files (Cars.txt and detailReport.txt) and then will print out the output that correspond to the cars details giving in detailReport.txt'

Here is a general skeleton of what you should have: (Note: you can use string and vector for the program)

- A Structure ErrorList that have 2 variables errorCode (int) and errorMessage (string);

- A Class Car that have 4 private variables (name (string), errorSize (int); error (int *), numOfCar (static int)). (You have to make error a int* since each car have random amount of error and depend on errorSize). You need atleast constructor, destructor, mutators and accessors (get and set for each variable). You can add more functions if it need be.

- In main()

Read in detailReport.txt to an array of ErrorList.

Read in Cars.txt into an array of Car.

Once you have all the data into correct places in the program, do exceptional handling to print out each car with its errors (and throw Car is in good shape if Error is 0). Tips: When you read Cars.txt into program, be careful how you handle the numbers of errors for each car. Since each car have random amount of errors, if you just use a loop to read, it might crash your program; therefore you could read in as a string of words, then split the string into array of vector. After that set each element of the vector into correct location.

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!