Kevin321888999

Lab 3 part B

Mar 4th, 2022
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.69 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. double sub(double num1, double num2){//write the prototypes.
  5.   double result;// The function definitions.
  6.   result=num1-num2;
  7.   return result;
  8. }
  9. double multi(double num1, double num2){
  10. double result;
  11. result=num1*num2;
  12. return result;
  13. }
  14. double add(double num1, double num2, double num3){
  15.   double result;
  16.   result=num1+num2+num3;
  17.   return result;}
  18. double every(double num1, double num2, double num3){
  19.   double result;
  20.   result=num1-num2-num3;
  21. return result;
  22. }
  23.  
  24. int main(void) {
  25. double gross;// Declare the variables as doubles
  26. double MPD= 75.65;// Set the constants
  27. double SSTR= 0.0751;
  28. double FITR=0.165;
  29. double SITR=0.045;
  30. double UFD=15.00;
  31. double SS;
  32. double fed;
  33. double taxable;
  34. double tests;
  35. double taxes3;
  36. double state;
  37. double takehome;
  38.  
  39. while (tests){//This goes on for infinite loops.
  40. printf("Enter Gross Pay: ");
  41. scanf("%lg",&gross);// Have the user entereth Gross income.
  42. if (gross>=15.00){// limits the gross income to above or equal to $15.00.
  43. taxable=sub(gross,MPD);// Function Calls.  
  44. SS= multi(taxable,SSTR); //Social Security tax
  45. fed=multi(taxable,FITR);//Federal Tax
  46. state=multi(taxable,SITR);//State tax
  47. taxes3=add(SS,fed,state);// Add the three taxes together.
  48. takehome= every(taxable,taxes3,UFD);//taxable-(SS+fed+state)-United Fund.
  49. 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);
  50. }
  51. 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.
  52.  
  53.  
  54.   return 0;}
Advertisement
Add Comment
Please, Sign In to add comment