Question: Program in C++ text file is: (need to save in data.txt to be able to read) Camry 2ABC334 102324 Corolla 7ABC234 12989 CRV 7ABC564 24787

 Program in C++ text file is: (need to save in data.txt

Program in C++

text file is: (need to save in data.txt to be able to read)

Camry 2ABC334 102324

Corolla 7ABC234 12989

CRV 7ABC564 24787

Corolla 7LMN234 23745

Camry 2DEF334 142090

CRV 7DEF564 42321

Corolla 7ABC809 60026

Corolla 7EFG234 45056

Focus 5KNA305 105201

Camry 2DAF304 112805

cpp file:

include

#include

#include "CarInventory.h"

using namespace std;

int main() {

CarInventory myCarInventory("data.txt");

cout

cout

string car = myCarInventory.getClosestMileage(60000);

if (car == "")

cout

else {

cout

cout

cout

cout

}

system("pause");

}

EPP (4pm) Fall 2018 Write a class that reads in a text file with the inventory of a used car store. Each line file contains three pieces of information separated by whitespaces. These are a txt of a car, its license plate number, and its mileage. An example is given below (fie dat ext el name in the t Camry 2ABC334 102324 Corolia 7ABC234 12989 CRV Corolla 7LMN234 23745 Canry 2DEF334 142090 CRV 7ABC564 24787 7DEF564 42321 Corolla 7ABC809 60026 Corolla TEFG234 45056 of e Focus 5KNA305 105201 Camry 2DAF304 112805 Implement a class CarInventory that reads in such a text file. The class should have the following public member functions: . CarInventory (string filename): the constructor which takes in the filename of the data and reads in the data to its member variables int numberofcars (): returns the number of cars in the store, ie., the number of lines in the file? (e.g., 10 for the data file shown above) string getModel (string license) : returns the model name as a string for the input license plate number (e.g., given 7LMN234, return Corolla) int license plate number (e.g., given 7LMN2 34, return 23745) . getMileage (string license): returns the mileage as an int for the input . string getClosestMileage (int mileage): returns the license plate number of the car which has the closest mileage above or equal to the input mileage. (e.g., given 60000, return 7ABC8o9 since its mileage 60026 is closest to 60000 and also 2 60000). If there is no such car, return the empty string These public member functions will be called from the provided main program and the answers printed there (see file part2.cpp -do not change the contents of this file) You are free to add other (public/private) member variables and functions as needed Implement all your code in one header file called CarInventory.h Simplifying assumptions: The maximum number of cars in the database is 1,000,000 Model names and licence plate numbers are a single word without spaces. Mileage is an integer . You do not need to do any error-checking when reading the data file Resources: You are given files containing templates for a Stack, Queue, and Vector class. For each of the data structures, you are also provided with a test program. You may use none, any, or all of them if it will help you. You are also free to edit any of these files. All these files are posted in the "EPP Part 2 Files" section. You can also use the STL versions of any data structures. ile upload: Upload CarInventory.h, along with any data structure files that you used

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!