Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer the following question in C++ code. Please add comments. Write a program that maintains the sales of a company. The program keeps records

Please answer the following question in C++ code. Please add comments. image text in transcribed
image text in transcribed
image text in transcribed
Write a program that maintains the sales of a company. The program keeps records of quarterly sales of every division in the company. Each record contains a given division's information such as name and quarterly sales. The program also performs several functionalities such as: adding a new division record, updating a division's sales, removing a division record, displaying a division's sales as well as the overall company's yearly sale, displaying highest and lowest quarters for the company, and saving the divisions data in an output file. You need to create a structure, Division, to hold individual division details and a vector of Division structs, called divisions, to hold the data for all the company's divisions. The Division struct contains the following fields: struct Div:sion str ng nane: double quarterlySalea ; The program should read and process a transaction file "Divisions Trans.txf". The transaction file DivisionsTrans.txt" contains several commands such as "display. "add", "search", "delete", "update", "calculateTotalSales", "highestLowesQuarter", "save". Fach command is written on a new line along with some other related information: - Display This command displays the details of all divisions in a neat table format. Details include the name of the division, the quarterly sales and total sales for that division. For example: Division aarterl Cuarter2 Quarter3 Quarter4 CotalSales raging And Pr i rti ng Deaktopa Notebooks Workatations 22979.00 23854.00 1151-C 25764.00 88748.00 13197.00 12844.00 13888-C 15478.00 55407.00 17540.00 16029.00 18830-C 22545.00 74944.00 2218.00 2147.002149.CO 176.00 8299.00 Note: Decimal numbers should be printed with 2 digits of precision. There are no spaces in the division names in the transaction file. Each new word in division name starts with capital letter. You need to print them separated by spaces as shown above. - Add Division Name DivisionQuarterlSales DivisionQuarter 2Sales DivisionQuarter 3Sales This command adds a new Division record to the divisions vector. The program should read the Division details from the transaction file DivisionName, DivisionQuarter Sales DivisionQuarter 2Sales, DivisionQuarter3Sales, DivisionQuarter&Sales). The program should check for valid sales values (positive values) and duplicate Division entries (same DivisionName). If the Division does not exist in the vector and the inputs are valid, the program should add an entry for that Division and its details at the end of the vector. You can simply use the push back function to add it to the end of the vector. The program should also display a message that the Division was successfully added to the vector. For example: add ImagingAndPrinting 22979.00 23854 "DO 16151. 25764.00

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

More Books

Students also viewed these Databases questions

Question

What is a hinge spread?

Answered: 1 week ago