Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class NumberInRange {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String product = scanner.nextLine();
- String city = scanner.nextLine();
- double quantity = Double.parseDouble(scanner.nextLine());
- double priceProduct = 0;
- if (city.equals("Sofia")) {
- if (product.equals("coffee")) {
- priceProduct = 0.50 * quantity;
- }
- }
- if (city.equals("Sofia")) {
- if (product.equals("water")) {
- priceProduct = 0.80 * quantity;
- }
- }
- if (city.equals("Sofia")) {
- if (product.equals("beer")) {
- priceProduct = 1.20 * quantity;
- }
- }
- if (city.equals("Sofia")) {
- if (product.equals("sweets")) {
- priceProduct = 1.45 * quantity;
- }
- }
- if (city.equals("Sofia")) {
- if (product.equals("peanuts")) {
- priceProduct = quantity * 1.60;
- }
- } else if (city.equals("Plovdiv")) {
- if (product.equals("coffee")) {
- priceProduct = 0.40 * quantity;
- }
- }
- if (city.equals("Plovdiv")) {
- if (product.equals("water")) {
- priceProduct = 0.70 * quantity;
- }
- }
- if (city.equals("Plovdiv")) {
- if (product.equals("beer")) {
- priceProduct = quantity * 1.15;
- }
- }
- if (city.equals("Plovdiv")) {
- if (product.equals("sweets")) {
- priceProduct = 1.30 * quantity;
- }
- }
- if (city.equals("Plovdiv")) {
- if (product.equals("peanuts")) {
- priceProduct = quantity * 1.50;
- }
- } else if (city.equals("Varna")) {
- if (product.equals("coffee")) {
- priceProduct = quantity * 0.45;
- }
- }
- if (city.equals("Varna")) {
- if (product.equals("water")) {
- priceProduct = quantity * 0.70;
- }
- }
- if (city.equals("Varna")) {
- if (product.equals("beer")) {
- priceProduct = quantity * 1.10;
- }
- }
- if (city.equals("Varna")) {
- if (product.equals("sweets")) {
- priceProduct = quantity * 1.35;
- }
- }
- if (city.equals("Varna")) {
- if (product.equals("peanuts")) {
- priceProduct = quantity * 1.55;
- }
- }
- System.out.printf("%.1f", priceProduct);}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement