225k views
0 votes
(C programming) Workers at a particular company have won a 7.6% pay increase retroactive for 6 months.

Write a program that takes an employee's previous annual salary as input and outputs the amount of retroactive pay due to the employee, the new annual salary and the new monthly salary.
Use a variable declaration with the modifier const to express the pay increase. Your program should allow the calculation to be repeated as often as the user wishes.
Sample output as follows:
- Enter current annual salary: 100000 Program should return new annual salary, monthly salary, and retroactive pay. new annual salary 107600 new monthly salary 8966.67 when user input 0 stop the program.

User Arennuit
by
8.7k points

1 Answer

1 vote

Final answer:

To calculate the retroactive pay due to the employee, the new annual salary, and the new monthly salary, you can use a C program. The program prompts the user to enter their current annual salary and calculates the retroactive pay, new annual salary, and new monthly salary using the provided pay increase percentage. The program can be repeated until the user enters 0 to stop.

Step-by-step explanation:

To calculate the retroactive pay due to the employee, the new annual salary, and the new monthly salary, you can use the following C program:



#include <stdio.h>

int main() {
const float PAY_INCREASE = 0.076; // 7.6% pay increase
float previousSalary, retroactivePay, newAnnualSalary, newMonthlySalary;

printf("Enter current annual salary: ");
scanf("%f", &previousSalary);

retroactivePay = previousSalary * PAY_INCREASE / 2;
newAnnualSalary = previousSalary + retroactivePay;
newMonthlySalary = newAnnualSalary / 12;

printf("\\Retroactive pay due: $%.2f", retroactivePay);
printf("\\New annual salary: $%.2f", newAnnualSalary);
printf("\\New monthly salary: $%.2f", newMonthlySalary);

return 0;
}



In this program, the const float PAY_INCREASE is set to 0.076, representing the 7.6% pay increase. The program prompts the user to enter their current annual salary and calculates the retroactive pay due to the employee, the new annual salary, and the new monthly salary. The retroactive pay is calculated as half of the pay increase multiplied by the previous salary. The new annual salary is the sum of the previous salary and the retroactive pay, and the new monthly salary is the new annual salary divided by 12.



You can run this program as many times as you want, and it will continue to prompt for the current annual salary until you enter 0 to stop the program.

User Hese
by
8.1k points