Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Opg1 {
  4. public static void main(String[] args) {
  5. new Opg1().run();
  6. }
  7.  
  8. public void run() {
  9. Scanner scan = new Scanner(System.in);
  10. int salary = scan.nextInt();
  11.  
  12. calculateTaxes(salary);
  13.  
  14. }
  15.  
  16. public void calculateTaxes(int salary) {
  17. double schijf1 = 0;
  18. double schijf2 = 0;
  19. double schijf3 = 0;
  20. double schijf4 = 0;
  21. if (salary <= 0) {
  22. System.out.println("Invalid Salary");
  23. } else if (salary <= 19982) {
  24. schijf1 = salary * 0.3655;
  25. System.out.println("Schijf 1: 36.55% over " + salary + " = " + schijf1);
  26. System.out.println("Schijf 2: 40.80% over 0 = 0");
  27. System.out.println("Schijf 3: 40.80% over 0 = 0");
  28. System.out.println("Schijf 4: 52.00% over 0 = 0");
  29. } else if (salary <= 33791) {
  30. schijf1 = 19982 * 0.3655;
  31. schijf2 = (salary - 19982) * 0.4080;
  32. System.out.println("Schijf 1: 36.55% over 19982 = " + schijf1);
  33. System.out.println("Schijf 2: 40.80% over " + (salary - 19982) + " = " + schijf2);
  34. System.out.println("Schijf 3: 40.80% over 0 = 0");
  35. System.out.println("Schijf 4: 52.00% over 0 = 0");
  36. } else if (salary <= 67072) {
  37. schijf1 = 19982 * 0.3655;
  38. schijf2 = (33791 - 19982) * 0.4080;
  39. schijf3 = (salary - 33791) * 0.4080;
  40. System.out.println("Schijf 1: 36.55% over 19982 = " + schijf1);
  41. System.out.println("Schijf 2: 40.80% over " + (33791 - 19982) + " = " + schijf2);
  42. System.out.println("Schijf 3: 40.80% over " + (salary - 33791) + " = " + schijf3);
  43. System.out.println("Schijf 4: 52.00% over 0 = 0");
  44. } else {
  45. schijf1 = 19982 * 0.3655;
  46. schijf2 = (33791 - 19982) * 0.4080;
  47. schijf3 = (67072 - 33791) * 0.4080;
  48. schijf4 = (salary - 67072) * 0.52;
  49. System.out.println("Schijf 1: 36.55% over 19982 = " + schijf1);
  50. System.out.println("Schijf 2: 40.80% over " + (33791 - 19982) + " = " + schijf2);
  51. System.out.println("Schijf 3: 40.80% over " + (67072 - 33791) + " = " + schijf3);
  52. System.out.println("Schijf 4: 52.00% over " + (salary - 67072) + " = " + schijf4);
  53. }
  54. double taxesPaid = schijf1 + schijf2 + schijf3 + schijf4;
  55. System.out.println("Totaal: " + taxesPaid);
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement