Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

vehicle file ( vehiclein.txt) 2010 Ford Escape 2014 BMW 328xi 2014 BMW 428xi 2012 Ford Fusion SE 2014 Lamborghini Gallardo 1967 Pontiac GTO 1983 DeLorean

vehicle file (vehiclein.txt) 2010 Ford Escape 2014 BMW 328xi 2014 BMW 428xi 2012 Ford Fusion SE 2014 Lamborghini Gallardo 1967 Pontiac GTO 1983 DeLorean DMC-12 1990 Audi 80 Sedan

An Extra Explanation of HW#3:

vehicle files:

will include the vehicle class which represents the ADT of one vehicle (make, model, Year) in that class you will have your setter and getter functions plus a function that overload the

main.cpp:

you will create a vector of objects each element includes one vehicle object, at the beginning read from the file to save the objects data, each three consecutive lines represent (year, model, and make) for a single object in the vector.

then once you fill your vector you will ask the user to choose from a menu that looks like:

Please enter your choice:

1.Sort by make then Search by make recursively

2.Sort by model then Search by model recursively

3.Sort by year then Search by year recursively (optional yet if you did not do this option so option 1 and 2 will be search by Year )

4.Sort by make then Search by make iteratively

5.Sort by model then Search by model iteratively

6.Sort by year then Search by year iteratively (optional yet if you did not do this option so option 4 and 5 will be search by Year )

7. Exit

each of them except 7 will call a function in functions.cpp

functions files:

By choosing option 1 from the main you will first call a sort function that will sort your vector by make then you will call another function to search for all the makes in that vector by asking the user what make are you searching for and then scan the sorted vector to print out all the objects that have the same make. Your search function should be a recursive function

By choosing option 2 from the main you will first call a sort function that will sort your vector by model then after sorting you will call another function to search for all the models in that vector by asking the user what model are you searching for and then scan the sorted vector to print out all the objects that have the same model. Your search function should be a recursive function

Choosing 3 will be the same as 1 and 2 the only difference is that your sort and search must be by Year.

By choosing option 4 from the main you will first call a sort function that will sort your vector by make then you will call another function to search for all the makes in that vector by asking the user what make are you searching for and then scan the sorted vector to print out all the objects that have the same make. Your search function should using loops (iteration) not a recursive function. so the difference between 1 and 4 is in the search function not the sort function.

5, and 6 will like 4 you just need to change the sort and search criteria to be by model and year respectively.

Your functions in functions.cpp should call the public functions of your class (setter and getter) to do their job.image text in transcribed

Recursion vs Iterative functions. For this assignment you will make a Vehicle class with two recursive member functions. a) Implement overloaded member functions called binSearchRec,the recursive binSearchRec algorithm is presented in this chapter, starting on page 68 for an array of vehicles. Usea vector instead of an array. Sort by make then call a recursive function to do a binary search which lists out the make, model and year for the first year found (or report accordingly) that matches the for a user input. then start a new sort Sort by model then call a recursive function to do a binary search which lists out the make model and year for the first year found (or report accordingly) that matches the for a user input. Read in the vehicles from a vehicle file (vehiclein.txtthat has a year, make, and model. You have a choice of reading in an integer and two strings OR reading in 3 strings and converting the year to an int. Remember that between a stream operator () and a getline, you need a ignore (e.g infile.ignore)) You should not use a .ignore) between a getline and a

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

Step: 3

blur-text-image

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

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions

Question

7-16 Compare Web 2.0 and Web 3.0.

Answered: 1 week ago