Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Program Scenario: Bubba of Bubbas Luxury Pre-Owned Imports has requested an onli

ID: 3550534 • Letter: P

Question

Program Scenario: Bubba of Bubbas Luxury Pre-Owned Imports has requested an online system to enable instant queries and updates to his automobile information database.


1 Create the file, AutoSales.h in your prog2 subdirectory, and include (#include AutoSales.h) as a header file in your source file, program2.cc. Use commands for conditional compilation. The file includes:

1. a structure called Auto and nested structure named Sold. See Requirements #7 below.

2. the class specification/declaration for class named, AutoSales, including the function/method

prototypes (declarations).

a. AutoSales Private section:

i. pointer to the dynamically allocated array of Auto structures


302172 2001 1 3980.00 0.00 0

302201 2010 4 28000.00 26789.99 22

313207 2008 2 11999.00 9321.88 15

:

ii. Maximum size of the array.

iii. Actual number of elements in the array

iv. Linear Ordered Search prototype: See requirement #6.

v. Binary Search prototype: See requirement #6.

vi. Others ?....

b. AutoSales Public section:

i. Constructor with an int input parameter to get dynamic memory for Auto array list (max 20), set max size (private), and set initial number (private) to 0.

ii. Copy constructor: Define even if your program does not utilize one.

iii. Destructor to release memory

iv. Method prototype for transaction # 1 View item

v. Method prototype for transaction # 2 Add/Insert item

vi. Others ? ....

3. the method definitions (header and body) for the class AutoSales.

2. Create the private methods for the Linear Ordered Search algorithm for an ordered/sorted array and the Binary Search. Invoke the Binary Search before transactions #1. Invoke the Ordered Search for transaction #2. RECALL: The Ordered Search algorithm must be optimized to halt the search if the item cannot be found. Return true if found, false if not found. If the ID is not found, the index position of where it would have been must be returned to facilitate the add (insertion) of the new auto. Duplicate IDs are not permitted.

3. The program must use text file input using ifstream. The files should be checked for successful open and properly closed.

Input ASCII text file: Auto.data, Ordered in increasing order by the auto id; one record per line.


< Sold >

Records in the following format, fields separated by spaces:

Auto ID

(int 6 digits) Model

Year

(int 4 digits) Model

Code

(int

1-digit) Auto

Selling

Price

(real) Auto

Buyer

Price

(real) Salesperson ID

(max 3 digits)

New line

There is a maximum of 20 automobiles. The inventory data file (Auto.data) will be stored in a 1-D partially filled array of structures which has been dynamically allocated and is private to the class AutoSales. It must be an array of structures, , which has a nested hierarchical structure, Sold, containing members Auto Buyer Price and Auto Salesperson ID. Application side will read until end of file is reached; use the Add public method to insert into the private array. Assume no duplicates in the file.

Input ASCII text file: Transactions.data Transactions are in random order. Transactions are processed until end of file is reached. The file entries follow the specification; there are no error transaction codes in the input file . However, for the view, the Auto ID may be erroneous (no match found); for the add, there may be an existing Auto ID. Transactions appear in the following formats:

Transaction Code


View Auto ID

Newline

Transaction Code


Auto ID

(int 6 digits) Model

Year

(int 4 digits) Model

Code

(int

1-digit) Auto

Selling

Price

(real) Auto

Buyer

Price

(real) Salesperson ID

(max 3 digits)

New line

ASCII Text Output file: Report.out

The output report must include a good title and formatted output. For both transactions, all data must be printed. As each transaction is read from transactions.data, a log of the processing is written to Report.out. Error messages should be clearly and easily understood.

A model description must be printed and not the Model Code. Use a ragged array to print the appropriate model description. Example: string modelDescription[] = {DUMMY,AUDI, BMW};

Code Description

1 Audi

2 BMW

3 Jaguar

4 Lexus

5 Honda

DO NOT PRINT IN THE ADT METHODS!

ERRORS ARE MANAGED ON THE APPLICATION SIDE.

Explanation / Answer

#include #include #include #include #include char* permute(int strt, int end, char* str) { char *outp=(char *)malloc(2000*sizeof(char)); for(int k=strt;k=0;i--) { if(strcmp(stLst[i],stra)==0) return 0; else if(strcmp(stra,stLst[i])
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote