Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- double sub(double num1, double num2){//write the prototypes.
- double result;// The function definitions.
- result=num1-num2;
- return result;
- }
- double multi(double num1, double num2){
- double result;
- result=num1*num2;
- return result;
- }
- double add(double num1, double num2, double num3){
- double result;
- result=num1+num2+num3;
- return result;}
- double every(double num1, double num2, double num3){
- double result;
- result=num1-num2-num3;
- return result;
- }
- int main(void) {
- double gross;// Declare the variables as doubles
- double MPD= 75.65;// Set the constants
- double SSTR= 0.0751;
- double FITR=0.165;
- double SITR=0.045;
- double UFD=15.00;
- double SS;
- double fed;
- double taxable;
- double tests;
- double taxes3;
- double state;
- double takehome;
- while (tests){//This goes on for infinite loops.
- printf("Enter Gross Pay: ");
- scanf("%lg",&gross);// Have the user entereth Gross income.
- if (gross>=15.00){// limits the gross income to above or equal to $15.00.
- taxable=sub(gross,MPD);// Function Calls.
- SS= multi(taxable,SSTR); //Social Security tax
- fed=multi(taxable,FITR);//Federal Tax
- state=multi(taxable,SITR);//State tax
- taxes3=add(SS,fed,state);// Add the three taxes together.
- takehome= every(taxable,taxes3,UFD);//taxable-(SS+fed+state)-United Fund.
- printf("Social security tax= %lg\n Federal income tax= %lg\n State income tax= %lg\n Medical deduction= %lg\n United Fund= %lg\n Take-home pay= %lg\n\n",SS,fed,state,MPD, UFD,takehome);
- }
- if (gross<15.00){printf("Try again!\n"); }}// If the Gross is anything under the $15 limit, the program will tell the user to try again and loop them back to the beginning.
- return 0;}
Advertisement
Add Comment
Please, Sign In to add comment