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