Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.73 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class NumberInRange {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String product = scanner.nextLine();
  8.         String city = scanner.nextLine();
  9.         double quantity = Double.parseDouble(scanner.nextLine());
  10.         double priceProduct = 0;
  11.  
  12.  
  13.         if (city.equals("Sofia")) {
  14.             if (product.equals("coffee")) {
  15.                 priceProduct = 0.50 * quantity;
  16.             }
  17.         }
  18.         if (city.equals("Sofia")) {
  19.             if (product.equals("water")) {
  20.                 priceProduct = 0.80 * quantity;
  21.             }
  22.         }
  23.         if (city.equals("Sofia")) {
  24.             if (product.equals("beer")) {
  25.                 priceProduct = 1.20 * quantity;
  26.  
  27.             }
  28.         }
  29.         if (city.equals("Sofia")) {
  30.             if (product.equals("sweets")) {
  31.                 priceProduct = 1.45 * quantity;
  32.             }
  33.         }
  34.         if (city.equals("Sofia")) {
  35.             if (product.equals("peanuts")) {
  36.                 priceProduct = quantity * 1.60;
  37.  
  38.  
  39.             }
  40.         } else if (city.equals("Plovdiv")) {
  41.             if (product.equals("coffee")) {
  42.                 priceProduct = 0.40 * quantity;
  43.             }
  44.         }
  45.         if (city.equals("Plovdiv")) {
  46.             if (product.equals("water")) {
  47.                 priceProduct = 0.70 * quantity;
  48.             }
  49.         }
  50.         if (city.equals("Plovdiv")) {
  51.             if (product.equals("beer")) {
  52.                 priceProduct = quantity * 1.15;
  53.             }
  54.         }
  55.         if (city.equals("Plovdiv")) {
  56.             if (product.equals("sweets")) {
  57.                 priceProduct = 1.30 * quantity;
  58.             }
  59.         }
  60.         if (city.equals("Plovdiv")) {
  61.             if (product.equals("peanuts")) {
  62.                 priceProduct = quantity * 1.50;
  63.  
  64.  
  65.             }
  66.         } else if (city.equals("Varna")) {
  67.             if (product.equals("coffee")) {
  68.                 priceProduct = quantity * 0.45;
  69.             }
  70.         }
  71.         if (city.equals("Varna")) {
  72.             if (product.equals("water")) {
  73.                 priceProduct = quantity * 0.70;
  74.             }
  75.         }
  76.         if (city.equals("Varna")) {
  77.             if (product.equals("beer")) {
  78.                 priceProduct = quantity * 1.10;
  79.             }
  80.         }
  81.         if (city.equals("Varna")) {
  82.             if (product.equals("sweets")) {
  83.                 priceProduct = quantity * 1.35;
  84.             }
  85.         }
  86.         if (city.equals("Varna")) {
  87.             if (product.equals("peanuts")) {
  88.                 priceProduct = quantity * 1.55;
  89.  
  90.  
  91.             }
  92.  
  93.  
  94.         }
  95.         System.out.printf("%.1f", priceProduct);}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement