Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SmallShop {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String product = scanner.nextLine().toLowerCase();
- String town = scanner.nextLine().toLowerCase();
- double quantity = Double.parseDouble(scanner.nextLine());
- if (town.equals("sofia")) {
- if (product.equals("coffee")) {
- System.out.println(quantity * 0.5);
- } else if (product.equals("water")) {
- System.out.println(quantity * 0.8);
- } else if (product.equals("beer")) {
- System.out.println(quantity * 1.2);
- } else if (product.equals("sweets")) {
- System.out.println(quantity * 1.45);
- } else if (product.equals("peanuts")) {
- System.out.println(quantity * 1.6);
- } else if (town.equals("plovdiv")) {
- if (product.equals("coffee")) {
- System.out.println(quantity * 0.4);
- } else if (product.equals("water")) {
- System.out.println(quantity * 0.7);
- } else if (product.equals("beer")) {
- System.out.println(quantity * 1.15);
- } else if (product.equals("sweets")) {
- System.out.println(quantity * 1.3);
- } else if (product.equals("peanuts")) {
- System.out.println(quantity * 1.5);
- } else (town.equals("varna")) {
- if (product.equals("coffee")) {
- System.out.println(quantity * 0.45);
- } else if (product.equals("water")) {
- System.out.println(quantity * 0.7);
- } else if (product.equals("beer")) {
- System.out.println(quantity * 1.1);
- } else if (product.equals("sweets")) {
- System.out.println(quantity * 1.35);
- } else if (product.equals("peanuts")) {
- System.out.println(quantity * 1.55);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement