Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import apcslib.Format;
  2. import chn.util.*;
  3.  
  4. public class Taxes {
  5.  
  6. public static void main(String[] args)
  7. {
  8. ConsoleIO input = new ConsoleIO();
  9. final double FEDERAL_TAX = 0.15;
  10. final double FICA = 0.0765;
  11. final double STATE_TAX = 0.04;
  12.  
  13. System.out.print("How many hours did you work? ");
  14. int hours = input.readInt();
  15.  
  16. System.out.print("What is your hourly rate? ");
  17. double hourlyRate = input.readDouble();
  18.  
  19. double grossPay = (hours * hourlyRate);
  20.  
  21. double federalTaxIncluded = (grossPay * FEDERAL_TAX);
  22. double ficaTaxIncluded = (grossPay * FICA);
  23. double stateTaxIncluded = (grossPay * STATE_TAX);
  24.  
  25. double netPay = (grossPay - (federalTaxIncluded + ficaTaxIncluded + stateTaxIncluded));
  26.  
  27. System.out.println();
  28. System.out.println(Format.left("Federal Tax (15%) = ",30) + "$" + Format.left(federalTaxIncluded, 0, 2));
  29. System.out.println(Format.left("FICA Tax (7.65%) = ",30) + "$" + Format.left(ficaTaxIncluded, 0, 2));
  30. System.out.println(Format.left("State Tax (4%) = ", 30) + "$" + Format.left(stateTaxIncluded, 0, 2));
  31. System.out.print(Format.left("The bacon you take home: ", 30) + "$" + Format.left(netPay, 0, 2));
  32.  
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement