Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help I don't understand how to make the program. Please help due by midnight! Thank you! txt. file is here: Bowling Green 50234.98

I need help I don't understand how to make the program. Please help due by midnight! Thank you!

image text in transcribed

image text in transcribed

txt. file is here:

Bowling Green

50234.98

83456.90

150789.00

2502344.34

Hong Kong

4000000.12

3500000.99

4500000.00

9000000.34

Los Angeles

3000000.34

2000000.89

3000000.00

5002345.50

New York

2000000.12

1000000.22

3000000.24

5000000.99

Rio de Janeiro

5000034.56

6000000.34

4000000.98

7000000.54

San Francisco

2000000.49

4000000.71

3000003.77

3500000.90

Detroit

1234566.90

2009199.11

3456777.80

909888.89

Mandatory Instructions Write a program to read in and process sales data for all of the divisions in a company. This programm will give you practice with file input and pointers to structures. Name your program file: prog3.cpp. Input from file For each drvision in the company, five lines of data are stored in the data file prog3 txt in Division Name (string) Quarter 1 Sales (double) Quater 2 Sales (double) Quarter 3 Sales (double) Quarter 4 Sales (double) The file prog3.tit is stored in the class library. Copy this file to your own cs2020 directory from the lib directory as you have done before. Output Your program should prouce output on the screen showing the amounts for each division as well as the summary data shown in the sample output. Program Design Your main function should do the Dynamically allocate space for a Corporation structure and store its address in a corporation pointer variable. The data for the corporation includes the total sales for each quarter and the mumber of divisions in the corporation. 1. Total Quarter 1 Sales Total Quarter 2 Sales (double) Total Quarter 3 Sales (double) Total Quarter 4 Sales Number of Divisions (integer) 2. y allocate space for a Division structure and store the adress in a division pointer variable. The data for a company division inctudes its name and the four quarterly sales amounts (string and double) - see prog3.tst These pointers should be used in ALL processing with the corporation and division data,ie, these pointers ust be passed to functions. 3. Create a while loop to read in the sales data for each division from the prog3.tit file (one division per iteration of the loop) until all data is processed Create a report ike the one shown on the next page. To accomplish this call these three functions each time through the whie loop. a. Call a function named getDivision to read in the data for one division only. Pass h Division pointer and the input file object to this function. File objects such as ifstream infile should always be passed by reference. It should read

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

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions