SmallShop

 avatar
unknown
plain_text
4 years ago
2.0 kB
28
Indexable
import java.util.Scanner;

public class SmallShop {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String product = scanner.nextLine();
        String city = scanner.nextLine();
        double quontity = Double.parseDouble(scanner.nextLine());

        double pricePerProduct = 0;
        if (city.equals("Sofia")) {
            if (product.equals("coffee"))
                pricePerProduct = 0.50;
        } else if (product.equals("water")) {
            pricePerProduct = 0.80;
        } else if (product.equals("beer")) {
            pricePerProduct = 1.20;
        } else if (product.equals("sweets")) {
            pricePerProduct = 1.45;
        } else if (product.equals("peanuts")) {
            pricePerProduct = 1.60;

        } else if (city.equals("Plovdiv")) {
            if (product.equals("coffee")) {
                pricePerProduct = 0.40;
            } else if (product.equals("water")) {
                pricePerProduct = 0.70;
            } else if (product.equals("beer")) {
                pricePerProduct = 1.15;
            } else if (product.equals("sweets")) {
                pricePerProduct = 1.30;
            } else if (product.equals("peanuts")) {
                pricePerProduct = 1.50;
            } else if (city.equals("Varna")) {
                if (product.equals("coffee")) {
                    pricePerProduct = 0.45;
                } else if (product.equals("water")) {
                    pricePerProduct = 0.70;
                } else if (product.equals("beer")) {
                    pricePerProduct = 1.10;
                } else if (product.equals("sweets")) {
                    pricePerProduct = 1.35;
                } else if (product.equals("peanuts")) {
                    pricePerProduct = 1.55;
                }
            }


        }
        double totalsum = quontity * pricePerProduct;
        System.out.println(totalsum);

    }
}
Editor is loading...