Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int hp = Integer.parseInt(scanner.nextLine());
- String city = scanner.nextLine();
- String ecoStandart = scanner.nextLine();
- double taxWithoutDiscount;
- double tax;
- if (ecoStandart.equals("Euro 4")) {
- if (city.equals("Sofia")) {
- if (hp <= 37) {
- taxWithoutDiscount = 1.43 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (15 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 37 && hp <= 55) {
- taxWithoutDiscount = 1.50 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (15 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 55) {
- taxWithoutDiscount = 2.68 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (15 / 100.0));
- System.out.printf("%.2f lv", tax);
- }
- } else if (city.equals("Vidin")) {
- if (hp <= 37) {
- taxWithoutDiscount = 1.34 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (15 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 37 && hp <= 55) {
- taxWithoutDiscount = 1.40 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (15 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 55) {
- taxWithoutDiscount = 2.54 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (15 / 100.0));
- System.out.printf("%.2f lv", tax);
- }
- } else if (city.equals("Varna")) {
- if (hp <= 37) {
- taxWithoutDiscount = 1.37 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (15 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 37 && hp <= 55) {
- taxWithoutDiscount = 1.40 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (15 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 55) {
- taxWithoutDiscount = 2.57 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (15 / 100.0));
- System.out.printf("%.2f lv", tax);
- }
- }
- } else if (ecoStandart.equals("Euro 5")) {
- if (city.equals("Sofia")) {
- if (hp <= 37) {
- taxWithoutDiscount = 1.43 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (17 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 37 && hp <= 55) {
- taxWithoutDiscount = 1.50 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (17 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 55) {
- taxWithoutDiscount = 2.68 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (17 / 100.0));
- System.out.printf("%.2f lv", tax);
- }
- } else if (city.equals("Vidin")) {
- if (hp <= 37) {
- taxWithoutDiscount = 1.34 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (17 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 37 && hp <= 55) {
- taxWithoutDiscount = 1.40 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (17 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 55) {
- taxWithoutDiscount = 2.54 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (17 / 100.0));
- System.out.printf("%.2f lv", tax);
- }
- } else if (city.equals("Varna")) {
- if (hp <= 37) {
- taxWithoutDiscount = 1.37 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (17 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 37 && hp <= 55) {
- taxWithoutDiscount = 1.40 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (17 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 55) {
- taxWithoutDiscount = 2.57 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (17 / 100.0));
- System.out.printf("%.2f lv", tax);
- }
- }
- } else if (ecoStandart.equals("Euro 6")) {
- if (city.equals("Sofia")) {
- if (hp <= 37) {
- taxWithoutDiscount = 1.43 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (20 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 37 && hp <= 55) {
- taxWithoutDiscount = 1.50 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (20 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 55) {
- taxWithoutDiscount = 2.68 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (20 / 100.0));
- System.out.printf("%.2f lv", tax);
- }
- } else if (city.equals("Vidin")) {
- if (hp <= 37) {
- taxWithoutDiscount = 1.34 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (20 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 37 && hp <= 55) {
- taxWithoutDiscount = 1.40 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (20 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 55) {
- taxWithoutDiscount = 2.54 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (20 / 100.0));
- System.out.printf("%.2f lv", tax);
- }
- } else if (city.equals("Varna")) {
- if (hp <= 37) {
- taxWithoutDiscount = 1.37 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (20 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 37 && hp <= 55) {
- taxWithoutDiscount = 1.40 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (20 / 100.0));
- System.out.printf("%.2f lv", tax);
- } else if (hp > 55) {
- taxWithoutDiscount = 2.57 * hp;
- tax = taxWithoutDiscount - (taxWithoutDiscount * (20 / 100.0));
- System.out.printf("%.2f lv", tax);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement