Problem: Write a program in C that will calculate the salary raise for employees
ID: 3764425 • Letter: P
Question
Problem: Write a program in C that will calculate the salary raise for employees as follows:
if salary is between $0 < $30000 the rate is 7.0%
if salary is between $30000 <= $40000 the rate is 5.5%
if salary is more than $40000 the rate is 4.0%
Instructions Given:
1. Use the appropriate functions and pass parameters for this program. Include at least one function that uses the return statement (non-void) and at least one
function that does NOT use the return statement (void).
2. Write a function that allows user to input the salaries (as many as they want) using a loop (only while, do, or for loops allowed).
3. Write a function that calculates the raises, the new salaries (raise + salaries), the total of the original salaries, the total of raises and the total of all the new salaries with the raises.
4. Write a function to print the output formatted like the in the following example (please do not add anything other than the ones listed)
5. You may have more functions than the 3 listed above
6. Loops and simple if/ if else statments allowed. You may either use a while loop, do loop, or for loops. DO NOT USE structs, arrays, etc.
7. Do not include other header files other than stdio.h and stdlib.h
Salary Rate % Raise New Salary 0.00 25,000.00 30,000.00 35,000.00 40,000.00 40,001.00 45,000.00 $215,001.00 0.00 0.00 0.00 7.00 1,750.00 26,750.00 5.50 1,650.00 31,650.00 5.50 1,925.00 36,925.00 5.50 2,200.00 42,200.00 4.00 1,600.04 41,601.00 4.00 1,800.00 46,800.00 $10,925.04 $225,926.00 TotalExplanation / Answer
Answer:
int main() {
float basic;
float rate1=7.0;
float rate2=5.5;
float rate3=4.0;
float hike1,hike2,hike3;
float new_salary;
int ch=9;
switch(ch)
{
printf("Enter 0 to quit and any other number to proceed");
case 0:
exit(0);
break;
default:
printf("Enter basic salary of employee : ");
scanf("%d", &basic);
if(basic<=30000)
hike1= (rate1 * basic) / 100;
new_salary = basic + hike1;
else if(basic>30000 && basic<=40000)
hike2= (rate2 * basic) / 100;
new_salary = basic + hike2;
else
hike3= (rate3 * basic) / 100;
new_salary = basic + hike3;
printf(" The new salary is %f $",new_salary);
break;
return (0);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.