In: Computer Science
In C Program
#include
Create a C program that calculates the gross and net pay given a user-specified number of hours worked, at minimum wage.
Hours per Week: 30
Hourly Rate: $7.25
Gross Pay: $217.50
Net Pay: $176.06
Deductions
Federal: $21.75
State: $3.05
FICA: $13.49
Medicare: $3.15
Note, the only value the user provides is 30 hours per week
#include <stdio.h>
#define HOURLY_RATE 7.25
#define FEDERAL_DEDUCTION 21.75
#define STATE_DEDUCTION 3.05
#define FICA_DEDUCTION 13.49
#define MEDICARE_DEDUCTION 3.15
int main(void)
{
int hours;
printf("\nEnter the number of hours worked per week: ");
scanf("%d", &hours);
printf("\nHours per Week: %d\n", hours);
printf("\nHourly Rate: $%.2f\n", HOURLY_RATE);
double grossPay = (hours * HOURLY_RATE);
printf("Gross Pay: $%.2f\n", grossPay);
printf("\nDeductions:\n");
printf("Federal: $%.2f\n", FEDERAL_DEDUCTION);
printf("State: $%.2f\n", STATE_DEDUCTION);
printf("FICA: $%.2f\n", FICA_DEDUCTION);
printf("Medicare: $%.2f\n\n", MEDICARE_DEDUCTION);
double netPay = (grossPay - (FEDERAL_DEDUCTION + STATE_DEDUCTION + FICA_DEDUCTION + MEDICARE_DEDUCTION));
printf("Net Pay: $%.2f\n", netPay);
return 0;
}
******************************************************************** SCREENSHOT *******************************************************