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

Write a program that calculates and outputs the monthly paycheck information for

ID: 3633261 • Letter: W

Question

Write a program that calculates and outputs the monthly paycheck information for an employee, including all the amounts deducted from an employee’s gross pay, and the net pay that is due to the employee. The user of your program will know the employee’s name and the gross pay, marital status and number of children for the employee. Each employee has the following deductions taken from his gross pay:

Income Tax: 5% if single and 3% if married
Social Security 2%
Health Insurance $50 if single, $80 if married no children, $100 for married up to children and $130 if 3 or more children


Your program should deal with erroneous input values. Gross salary should always be a positive number.

1. Identify the inputs and outputs of the problem.

2. Identify the processing needed to convert the inputs to the outputs.

3. Design an algorithm in pseudocode to solve the problem. Make sure to include steps to get each input and to report each output. Include steps to deal with error cases.

4. Identify two test cases, one using a positive number, and one using a negative number. For each of the two test cases show what inputs you will use and what your expected outputs should be.

5. Write the program to implement your algorithm. Test your program using your test cases.

Explanation / Answer

please rate - thanks

#include <stdio.h>
#include <conio.h>
int main()
{double gross, net, income,SS,health;
int married, kids;
char name[30];
char* in;
printf("Enter name: ");
in=gets(name);
printf("Are you married?(1 for yes 0 for no): ");
scanf("%d",&married);
while(married<0||married>1)
    {printf("invalid entry ");
    printf("Are you married?(1 for yes 0 for no): ");
    scanf("%d",&married);
    }
printf("How many children do you have? ");
scanf("%d",&kids);
while(kids<0)
     {printf("must be >=0 ");
      printf("How many children do you have? ");
     scanf("%d",&kids);
     }
printf("Enter gross salary: ");
scanf("%lf",&gross);
while(gross<=0)
    {printf("must be positive ");
     printf("Enter gross salary: ");
     scanf("%lf",&gross);
     }
SS=gross*.02;
if(married==0)
    {income=gross*.05;
     health=50;
     }
else
      {income=gross*.03;
      if(kids==0)
           health=80;
      else if(kids<3)
           health=100;
      else
          health=130;
      }
net=gross-income-SS-health;
printf(" Information for ");
puts(name);
printf("Gross pay:        $%10.2f ",gross);
printf("Income tax:       $%10.2f ",income);
printf("Social Security: $%10.2f ",SS);
printf("Health insurance: $%10.2f ",health);
printf("Net pay:          $%10.2f ",net);
   
getch();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote