Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to prompt the user to enter the number of salaries to process (making sur

ID: 3624606 • Letter: I

Question

I need to prompt the user to enter the number of salaries to process (making sure: at least 2 salaries must be entered by user, I also need to give an appropriate polite error message of your choice.) . It should then prompt the user for each salary. As each salary is entered, the program should ensure that the salaries entered are in the salary range of zero and above. If the salary is not in that range, an error message should be displayed, and the user should be re-prompted for a salary. Any bad salaries entered should not be included in the average calculation. Once all values are entered, the program should calculate and print the average of all of the positive values entered, rounded off to the nearest whole cent.
The output should look like :
First, enter the number of salaries to process: 4

Now enter the 4 salaries to be averaged.


Enter salary #1: 900
Enter salary #2: 800
Enter salary # 3: -200
*** Invalid entry. Salary must be positive. ***
Enter salary #3: 2500
Enter salary #4: 540


The average of the 4 salaries entered is $1185.00


Your salaries are very generous.


Based on the averages,the output messages should read:
If average <= 999.99 display “Your salaries are low, how about a raise.”

If 1000 <= average < = 1999.99 display “Your salaries are very generous.”

If average >= 2000 display “Your salaries are very high.”



Also, a trap loop should be used so that at least two salaries are to be entered by the user.

Explanation / Answer

#include main () { int numSalaries=0, counter=0, salary[100], salarySum=0, averageSalary=0; printf ("Enter the number of salaries to process: "); scanf ("%i", &numSalaries); while (numSalaries2 && counter