Guest User

Untitled

a guest
Jan 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. // This is a template to be used for all single-class ITI 1120 programs.
  2. // The class shall contain 2 methods: main and a problem-solving method
  3.  
  4. // ITI 1120 Fall 2011
  5. // Name: Grace Hopper, Student#: 123456
  6. // General description of the program.
  7. import java.util.Scanner;
  8.  
  9. public class tax
  10. {
  11.  
  12. public static void main( String[] args )
  13. {
  14.  
  15. Scanner keyboard = new Scanner( System.in );
  16. double income;
  17. double totalTax;
  18.  
  19. System.out.println("Please enter your income");
  20.  
  21. income = ITI1120.readDouble();
  22. totalTax = calculateTotalTax(income);
  23. System.out.println("Your total tax is " + totalTax);
  24.  
  25. }
  26.  
  27. private static double calculateTotalTax(double income)
  28. {
  29. // DECLARATION OF THE RESULT VARIABLE
  30. double totalTax = 0;
  31. double federalTax = 0;
  32. double provincialTax = 0;
  33.  
  34. if (income <= 41544)
  35. {
  36. federalTax=0.15*income;
  37. }
  38. else if ((income >= 41544) && (income <= 83088))
  39. {
  40. federalTax=((income-41544)*0.22)+6232;
  41. }
  42. else if ((income >= 83088) && (income <= 128800))
  43. {
  44. federalTax=((income-83088)*0.26)+15371;
  45. }
  46. else if (income > 128800)
  47. {
  48. federalTax=((income-128800)*0.29)+27256;
  49. }
  50.  
  51. if (income <= 37774)
  52. {
  53. provincialTax= 0.0505*income;
  54. }
  55. else if ((income >=37774) && (income <=75500))
  56. {
  57. provincialTax=((income-37774)*0.0915)+1908;
  58. }
  59.  
  60. else if (income > 75500)
  61. {
  62. provincialTax=((income-75500)*0.1116)+5363;
  63. }
  64.  
  65. totalTax= federalTax + provincialTax;
  66.  
  67. return totalTax;
  68. }
  69. }
Add Comment
Please, Sign In to add comment