Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace MachineProblem1
  7. {
  8. class Program
  9. {
  10. // constant for calculating payment
  11. const double OVERTIME_RATE = 1.5;
  12. const double FEDERAL_RATE = .18;
  13. const double RETIRE_RATE = .10;
  14. const double SOCIAL_RATE = .6;
  15.  
  16. static void Main(string[] args)
  17. {
  18. // calculate and print the take-home pay for a sales employee
  19. Console.Write("Enter name: ");
  20. string name = Console.ReadLine();
  21.  
  22. Console.Write("Enter sales amount for the week: ");
  23. string line = Console.ReadLine();
  24. // convert the string line into an amount assuming it is a legal number
  25. double amount = double.Parse(line);
  26.  
  27. // now calculate gross pay
  28. double gross = amount * OVERTIME_RATE;
  29. // calculate taxe and contribution
  30. double federal_tax = gross * FEDERAL_RATE;
  31. double retire_con = gross * RETIRE_RATE;
  32. double social_tax = gross * SOCIAL_RATE;
  33.  
  34. // cacluate the final net pay
  35. double deductions = federal_tax + retire_con + social_tax;
  36. double netpay = gross - deductions;
  37.  
  38. // display the result
  39. Console.WriteLine();
  40. Console.WriteLine("Employee: " + name);
  41. Console.WriteLine("Sales: " + amount);
  42. Console.WriteLine("{0}% of amount results in gross pay: {1}", OVERTIME_RATE * 40, gross);
  43. Console.WriteLine("{0}% of gross pay is federal tax: {1}", FEDERAL_RATE * 40, federal_tax);
  44. Console.WriteLine("{0}% of gross pay is retirement contribution: {1}", RETIRE_RATE * 40, retire_con);
  45. Console.WriteLine("{0}% of gross pay is social security tax: {1}", SOCIAL_RATE * 40, social_tax);
  46. Console.WriteLine("Thus,");
  47. Console.WriteLine("Total deductions: " + deductions);
  48. Console.WriteLine("Final net pay: " + netpay);
  49. Console.ReadLine();
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement