Question: A store manager would like to know the total sales and the highest sale of a team of seven salespeople for last week. You will
A store manager would like to know the total sales and the highest sale of a team of seven salespeople for last week. You will write a program that ask the user to enter the sales for each salesperson and display the total and the highest sale with the salesperson id. The program should include the following function. Do not modify the function prototype.
void total_max(double sale[], int n, double * total, double * max, int * max_id);
The function takes an array parameter sale that contains the sales for salespeople, n is the length of the array. The total parameter points to a variable in which the function will store the total. The max parameter points to a variable in which the function will store the highest sale. The max_id parameter points to a variable in which the function will store the salespersons id for the highest sale.
1) Name your program sale.c.
2) The main function should ask the user to enter the sales for each of the seven salesperson and call the total_max function to calculate the total and max. The main function should contain the printf statements that display the result with two decimal digits.
Example input/output:
Enter sales for salesperson 1: 351.42
Enter sales for salesperson 2: 184.23
Enter sales for salesperson 3: 487.69
Enter sales for salesperson 4: 971.12
Enter sales for salesperson 5: 245.47
Enter sales for salesperson 6: 395.18
Enter sales for salesperson 7: 485.92
Output:
Total sales: 3121.03
Salesperson 4 has the highest sale: 971.12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
