Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1.  
  2.  
  3. #include <stdio.h>
  4. #include <ctype.h>
  5. #include <unistd.h>
  6. #include <string.h>
  7.  
  8.  
  9.  
  10. int main()
  11. { char fullname[100], forename[30],surname[50], code;
  12. int id;
  13. float gross, tax, net;
  14.  
  15.  
  16. //the use of toupper is for the use of both upper and lowercase entered from user
  17.  
  18. printf("This program will calculate your tax reduction and display employee information. \n \n");
  19. sleep(1);
  20.  
  21. do{
  22. printf("Please enter tax code: \nS for self-employed \nC for company employed \n");//the printf is requesting from the user
  23. scanf("%c", &code);//had to place before all
  24. code=toupper(code);
  25. if(code!='S' && code!='C')
  26. printf("invalid input \n\nPlease enter again\n\n");
  27. }while(code!='S' && code!='C');
  28.  
  29.  
  30.  
  31.  
  32. printf("Please enter Employee forename \n");
  33. scanf(" %s", forename); //scan string such as multiple inputs rather than just a single character
  34.  
  35. printf("Please enter Employee surname \n");
  36. scanf(" %s", surname); //scan string such as multiple inputs rather than just a single character
  37.  
  38. printf("Employee name %s %s \n\n", forename, surname);
  39.  
  40.  
  41.  
  42. printf("Please enter Employee ID \n");
  43. scanf("%d", &id); //decimal numbers
  44.  
  45. printf("Please enter Employee gross wage \n");
  46. scanf("%f", &gross); //float
  47.  
  48. if(code=='S' && gross>27000){
  49. net=gross-(gross*0.42);
  50.  
  51. }else if(code=='S' && gross>=20000){
  52. net=gross-(gross*0.23);
  53.  
  54. }else if(code=='S' && gross<20000){
  55. gross=net-(gross*0.2);
  56. }else if(code=='C'&& gross>29000){
  57. gross=net-(gross*0.4);
  58.  
  59. }else if(code=='C' && gross>=18000){
  60. gross=net-(gross*0.2);
  61.  
  62. }else if(code ='C' && gross<18000){
  63. gross=net-(gross*0.1);
  64. }
  65.  
  66.  
  67. tax=gross-net;
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. return 0;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement