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