Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a template to be used for all single-class ITI 1120 programs.
- // The class shall contain 2 methods: main and a problem-solving method
- // ITI 1120 Fall 2011
- // Name: Grace Hopper, Student#: 123456
- // General description of the program.
- import java.util.Scanner;
- public class tax
- {
- public static void main( String[] args )
- {
- Scanner keyboard = new Scanner( System.in );
- double income;
- double totalTax;
- System.out.println("Please enter your income");
- income = ITI1120.readDouble();
- totalTax = calculateTotalTax(income);
- System.out.println("Your total tax is " + totalTax);
- }
- private static double calculateTotalTax(double income)
- {
- // DECLARATION OF THE RESULT VARIABLE
- double totalTax = 0;
- double federalTax = 0;
- double provincialTax = 0;
- if (income <= 41544)
- {
- federalTax=0.15*income;
- }
- else if ((income >= 41544) && (income <= 83088))
- {
- federalTax=((income-41544)*0.22)+6232;
- }
- else if ((income >= 83088) && (income <= 128800))
- {
- federalTax=((income-83088)*0.26)+15371;
- }
- else if (income > 128800)
- {
- federalTax=((income-128800)*0.29)+27256;
- }
- if (income <= 37774)
- {
- provincialTax= 0.0505*income;
- }
- else if ((income >=37774) && (income <=75500))
- {
- provincialTax=((income-37774)*0.0915)+1908;
- }
- else if (income > 75500)
- {
- provincialTax=((income-75500)*0.1116)+5363;
- }
- totalTax= federalTax + provincialTax;
- return totalTax;
- }
- }
Add Comment
Please, Sign In to add comment