I'm having problem figuring out how to write the source code for a homework assignement and could really use some help.
Here the problem:
[Write a program that determines which of a company's 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:
1. double getSales() is passed the name of a division. It asks the user for a division's quarterly sales figure, validates the input, then returns it. It should be called once for each division.
2. 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]
CODE
//findHighest function definition
void findHighest()
{
double sales1, sales2, sales3. sales4;
double max = sales1;
if(sales2 > max)
max = sales2;
if(sales3 > max)
max = sales3;
if(sales4 > max)
max = sales4;
}
I think I have the second function worked out, but I'm not quite sure how to pass the names to the getSales() function or the four sales totals to the findHighest() function.
Also I can't figure out how I would get the findHighest function to print out the winning division's name, though I'm guessing it has to do with figuring out how to define the getSales() function.
Any help would be really appreciated!