Advertisement
Guest User

TaxCalculator

a guest
Dec 14th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TaxCalculator {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. int moshtnostDvigatel = Integer.parseInt(sc.nextLine());
  7. String grad = sc.nextLine();
  8. String ekoStandart = sc.nextLine();
  9.  
  10. //При "Euro 4" - 15% отстъпка
  11. //При "Euro 5" - 17% отстъпка
  12. //При "Euro 6" - 20% отстъпка
  13. double total = 0;
  14. switch (grad) {
  15. case "Sofia":
  16. if (moshtnostDvigatel <= 37) {
  17. total = moshtnostDvigatel * 1.43;
  18. } else if (moshtnostDvigatel >= 38 && moshtnostDvigatel <= 55) {
  19. total = moshtnostDvigatel * 1.5;
  20. } else {
  21. total = moshtnostDvigatel * 2.68;
  22. }
  23. break;
  24. case "Vidin":
  25. if (moshtnostDvigatel <= 37) {
  26. total = moshtnostDvigatel * 1.34;
  27. } else if (moshtnostDvigatel >= 38 && moshtnostDvigatel <= 55) {
  28. total = moshtnostDvigatel * 1.4;
  29. } else {
  30. total = moshtnostDvigatel * 2.54;
  31. }
  32. break;
  33. case "Varna":
  34. if (moshtnostDvigatel <= 37) {
  35. total = moshtnostDvigatel * 1.37;
  36. } else if (moshtnostDvigatel >= 38 && moshtnostDvigatel <= 55) {
  37. total = moshtnostDvigatel * 1.4;
  38. } else {
  39. total = moshtnostDvigatel * 2.57;
  40. }
  41. break;
  42. }
  43.  
  44. if (ekoStandart.equals("Euro 4")) {
  45. total = total - (total * 0.15);
  46. } else if (ekoStandart.equals("Euro 5")) {
  47. total = total - (total * 0.17);
  48. } else if (ekoStandart.equals("Euro 6")) {
  49. total = total - (total * 0.2);
  50. }
  51.  
  52. System.out.printf("%.2f lv", total);
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement