Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C + + program that determines which of a company s four divisions ( Northeast , Southeast, Northwest, and Southwest ) had the

Write a C++ program that determines which of a companys four divisions (Northeast,
Southeast, Northwest, and Southwest) had the greatest sales for a quarter. It should
include the following two functions, which are called by main .
double getSales() is passed the name of a division. It asks the user for a divisions
quarterly sales figure, validates the input, then returns it. It should be called once for
each division.
void findHighest() is passed the four sales totals. It determines which is the largest
and prints the name of the high grossing division, along with its sales figure.
Input Validation: Do not accept dollar amounts less than $0.00.
2. Design the following functions:
char ** createNamesDivision() does not have input parameters. It defines a dynamic two-dimensional array of characters of 4 x 10. The function returns the pointer to the main program.
int ** createSalesQuately() have one input parameter, two-dimensional division names array. It defines a dynamic two-dimensional array of floating points of 4 x 4 Returns the pointer to the main program.
void getVaues is passed the two-dimensional array of names of divisions and sales data and read for file the data values.
double *getTotalSales is passed the two-dimensional array of sales and returns each division's total sum in a one-dimensional array dynamically created.
void findHighest() is passed the two-dimensional array of division names and a one-dimensional array of total sales. It determines which is the largest and prints the name of the high grossing division, along with its sales figure.
Implement the main program that defines a text file to store a division name and sales of quarters for each division. Define the character array of the max capacity of 10 and the floating-point variable for reading each division sale.
For example:
Northeast 31569.4529654.2332982.5439651.21
Southeast 56321.0254128.6341235.8554652.33
Northwest 29654.3528963.3225353.5532615.88
Southwest 24854.7523763.1221355.5934625.68
The output of the program should be the following :
This program will calculate the total sales of all the company's divisions.
The following sales data:
Northeast division, Quarter 1: $31569.45
Northeast division, Quarter 2: $29654.23
Northeast division, Quarter 3: $32982.54
Northeast division, Quarter 4: $39651.21
The total sales for the Northeast division are: $133857.43
Southeast division, Quarter 1: $56321.02
Southeast division, Quarter 2: $54128.63
Southeast division, Quarter 3: $41235.85
Southeast division, Quarter 4: $54652.33
The total sales for the Southeast division are: $206337.83
Northwest division, Quarter 1: $29654.35
Northwest division, Quarter 2: $28963.32
Northwest division, Quarter 3: $25353.55
Northwest division, Quarter 4: $32615.88
The total sales for the Northwest division are: $116587.10
Southwest division, Quarter 1: $24854.75
Southwest division, Quarter 2: $23763.12
Southwest division, Quarter 3: $21355.59
Southwest division, Quarter 4: $34625.68
The total sales for the Southwest division are: $104599.14
The total sales for the company are: $561381.50
The Southeast division has the highest total sales.

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions