Answered step by step
Verified Expert Solution
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 $
Design the following functions:
char createNamesDivision does not have input parameters. It defines a dynamic twodimensional array of characters of x The function returns the pointer to the main program.
int createSalesQuately have one input parameter, twodimensional division names array. It defines a dynamic twodimensional array of floating points of x Returns the pointer to the main program.
void getVaues is passed the twodimensional array of names of divisions and sales data and read for file the data values.
double getTotalSales is passed the twodimensional array of sales and returns each division's total sum in a onedimensional array dynamically created.
void findHighest is passed the twodimensional array of division names and a onedimensional 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 and the floatingpoint variable for reading each division sale.
For example:
Northeast
Southeast
Northwest
Southwest
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 : $
Northeast division, Quarter : $
Northeast division, Quarter : $
Northeast division, Quarter : $
The total sales for the Northeast division are: $
Southeast division, Quarter : $
Southeast division, Quarter : $
Southeast division, Quarter : $
Southeast division, Quarter : $
The total sales for the Southeast division are: $
Northwest division, Quarter : $
Northwest division, Quarter : $
Northwest division, Quarter : $
Northwest division, Quarter : $
The total sales for the Northwest division are: $
Southwest division, Quarter : $
Southwest division, Quarter : $
Southwest division, Quarter : $
Southwest division, Quarter : $
The total sales for the Southwest division are: $
The total sales for the company are: $
The Southeast division has the highest total sales.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started