Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import apcslib.Format;
- import chn.util.*;
- public class Taxes {
- public static void main(String[] args)
- {
- ConsoleIO input = new ConsoleIO();
- final double FEDERAL_TAX = 0.15;
- final double FICA = 0.0765;
- final double STATE_TAX = 0.04;
- System.out.print("How many hours did you work? ");
- int hours = input.readInt();
- System.out.print("What is your hourly rate? ");
- double hourlyRate = input.readDouble();
- double grossPay = (hours * hourlyRate);
- double federalTaxIncluded = (grossPay * FEDERAL_TAX);
- double ficaTaxIncluded = (grossPay * FICA);
- double stateTaxIncluded = (grossPay * STATE_TAX);
- double netPay = (grossPay - (federalTaxIncluded + ficaTaxIncluded + stateTaxIncluded));
- System.out.println();
- System.out.println(Format.left("Federal Tax (15%) = ",30) + "$" + Format.left(federalTaxIncluded, 0, 2));
- System.out.println(Format.left("FICA Tax (7.65%) = ",30) + "$" + Format.left(ficaTaxIncluded, 0, 2));
- System.out.println(Format.left("State Tax (4%) = ", 30) + "$" + Format.left(stateTaxIncluded, 0, 2));
- System.out.print(Format.left("The bacon you take home: ", 30) + "$" + Format.left(netPay, 0, 2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement