Advertisement
veronikaaa86

Trade Comissions 2

Oct 2nd, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.05 KB | None | 0 0
  1. package ComplexConditions;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Demo {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String town = scanner.nextLine();
  10.         double salary = Double.parseDouble(scanner.nextLine());
  11.  
  12.         if (town.equals("Sofia")) {
  13.             if (salary >= 0 && salary <= 500) {
  14.                 System.out.printf("%.2f", salary * 0.05);
  15.             } else if (salary > 500 && salary <= 1000) {
  16.                 System.out.printf("%.2f", salary * 0.07);
  17.             } else if (salary > 1000 && salary <= 10000) {
  18.                 System.out.printf("%.2f", salary * 0.08);
  19.             } else if (salary > 10000) {
  20.                 System.out.printf("%.2f", salary * 0.12);
  21.             } else {
  22.                 System.out.println("error");
  23.  
  24.             }
  25.  
  26.  
  27.         } else if (town.equals("Varna")) {
  28.             if (salary >= 0 && salary <= 500) {
  29.                 System.out.printf("%.2f", salary * 0.045);
  30.             } else if (salary > 500 && salary <= 1000) {
  31.                 System.out.printf("%.2f", salary * 0.075);
  32.             } else if (salary > 1000 && salary <= 10000) {
  33.                 System.out.printf("%.2f", salary * 0.1);
  34.             } else if (salary > 10000) {
  35.                 System.out.printf("%.2f", salary * 0.13);
  36.             } else {
  37.                 System.out.println("error");
  38.             }
  39.  
  40.  
  41.         } else if (town.equals("Plovdiv")) {
  42.             if (salary >= 0 && salary <= 500) {
  43.                 System.out.printf("%.2f", salary * 0.055);
  44.             } else if (salary > 500 && salary <= 1000) {
  45.                 System.out.printf("%.2f", salary * 0.08);
  46.             } else if (salary > 1000 && salary <= 10000) {
  47.                 System.out.printf("%.2f", salary * 0.12);
  48.             } else if (salary > 10000) {
  49.                 System.out.printf("%.2f", salary * 0.145);
  50.             } else {
  51.                 System.out.println("error");
  52.  
  53.             }
  54.  
  55.         } else {
  56.             System.out.println("error");
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement