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 prod = scanner.nextLine().toLowerCase();
- String city = scanner.nextLine().toLowerCase();
- double col = Double.parseDouble(scanner.nextLine());
- double price = 0;
- if ("Sofia".equals(city)) {
- if ("coffee".equals(prod)) {
- price = 0.5;
- } else if ("water".equals(prod)) {
- price = 0.8;
- } else if ("beer".equals(prod)) {
- price = 1.2;
- } else if ("sweets".equals(prod)) {
- price = 1.45;
- } else if ("peanuts".equals(prod)) {
- price = 1.6;
- } else if ("Plovdiv".equals(city)) ;
- else if ("coffee".equals(prod)) {
- price = 0.4;
- } else if ("water".equals(prod)) {
- price = 0.7;
- } else if ("beer".equals(prod)) {
- price = 1.15;
- } else if ("sweets".equals(prod)) {
- price = 1.3;
- } else if ("peanuts".equals(prod)) {
- price = 1.5;
- } else if ("Varna".equals(city)) {
- if ("coffee".equals(prod)) {
- price = 0.5;
- } else if ("water".equals(prod)) {
- price = 0.8;
- } else if ("beer".equals(prod)) {
- price = 1.2;
- } else if ("sweets".equals(prod)) {
- price = 1.45;
- } else if ("peanuts".equals(prod)) {
- price = 1.6;
- }
- }
- } double result =price * col;
- System.out.println(result);
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement