Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TaxCalculator {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int moshtnostDvigatel = Integer.parseInt(sc.nextLine());
- String grad = sc.nextLine();
- String ekoStandart = sc.nextLine();
- //При "Euro 4" - 15% отстъпка
- //При "Euro 5" - 17% отстъпка
- //При "Euro 6" - 20% отстъпка
- double total = 0;
- switch (grad) {
- case "Sofia":
- if (moshtnostDvigatel <= 37) {
- total = moshtnostDvigatel * 1.43;
- } else if (moshtnostDvigatel >= 38 && moshtnostDvigatel <= 55) {
- total = moshtnostDvigatel * 1.5;
- } else {
- total = moshtnostDvigatel * 2.68;
- }
- break;
- case "Vidin":
- if (moshtnostDvigatel <= 37) {
- total = moshtnostDvigatel * 1.34;
- } else if (moshtnostDvigatel >= 38 && moshtnostDvigatel <= 55) {
- total = moshtnostDvigatel * 1.4;
- } else {
- total = moshtnostDvigatel * 2.54;
- }
- break;
- case "Varna":
- if (moshtnostDvigatel <= 37) {
- total = moshtnostDvigatel * 1.37;
- } else if (moshtnostDvigatel >= 38 && moshtnostDvigatel <= 55) {
- total = moshtnostDvigatel * 1.4;
- } else {
- total = moshtnostDvigatel * 2.57;
- }
- break;
- }
- if (ekoStandart.equals("Euro 4")) {
- total = total - (total * 0.15);
- } else if (ekoStandart.equals("Euro 5")) {
- total = total - (total * 0.17);
- } else if (ekoStandart.equals("Euro 6")) {
- total = total - (total * 0.2);
- }
- System.out.printf("%.2f lv", total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement