This program should calculate which division in a company had the greatest sales
ID: 3617567 • Letter: T
Question
This program should calculate which division in a company had the greatest sales
for a quarter. It should use the following functions:
- A function should ask the user for and return the quarterlysales
figures for the company's Northeast, Southeast, Northwest, andSouthwest divisions. - A function should determine which division had the highestsales figures.
Note: this function receives the nameof the division ('NorthEast', 'SouthEast', etc.). In this program,use a new datatype named 'string' (instead of character array) tohandle the name of the division. Find more information about'string' datatype on page 572 or 605 v4. But briefly, you will needto include the following library:
The following code for the
main function is a required starting point. Create the functions and
corresponding prototypes to make this work.
1,
int main()
{
float nE, sE, nW, sW;
nE = input_div( "North East" );
sE = input_div( "South East" );
nW = input_div( "North West" );
sW = input_div( "South West" );
findHighest(nE, sE, nW, sW); //prints the result also
return 0;
}
2.
float input_div( receiving 'string' type)
{
Code inputs dollar value for given division and returns it
(Use a while or do/while loop for validation)
}
#include < string> This will allow the following declaration: string name; Where 'name' could be the name of the division. This datatype willmake coding much easier, especially in the the 'findHighest'function, as described in the pseudocode below. void findHighest ( receiving 4 'float' types ) { Code determines the biggest of 4floats and prints the result to the screen. Note: No need to worryabout duplicates in this exercise. } Pseudocode forfindHighest(). Use extra variables to keep track of the highestvalue and its corresponding name. Assign these variables the firstvalues of the data and continue checking for and updating thehighest data, like this:
highest = nENote: this function receives the nameof the division ('NorthEast', 'SouthEast', etc.). In this program,use a new datatype named 'string' (instead of character array) tohandle the name of the division. Find more information about'string' datatype on page 572 or 605 v4. But briefly, you will needto include the following library:
name = "North East"
if sE > highest then
highest = sE
name = "South East"
if nW > highest then
highest = nW
name = "North West"
if sW > highest then
highest = sW
name = "South West"
cout "the highest is " name "with" highest
#include < string> This will allow the following declaration: string name; Where 'name' could be the name of the division. This datatype willmake coding much easier, especially in the the 'findHighest'function, as described in the pseudocode below. #include < string> string name; { Code determines the biggest of 4floats and prints the result to the screen. Note: No need to worryabout duplicates in this exercise. }