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 products = scanner.nextLine().toLowerCase();
- String town = scanner.nextLine().toLowerCase();
- double quantity = Double.parseDouble(scanner.nextLine());
- double productPrice = 0;
- if (town.equals("sofia")){
- if (products.equals("coffee")){
- productPrice = 0.5;
- }else if (products.equals("water")){
- productPrice = 0.8;
- }else if (products.equals("beer")){
- productPrice = 1.2;
- }else if (products.equals("sweets")){
- productPrice = 1.45;
- }else if (products.equals("peanuts")){
- productPrice = 1.6;
- }
- }else if (town.equals("plovdiv")){
- if (products.equals("coffee")){
- productPrice = 0.4;
- }else if (products.equals("water")){
- productPrice = 0.7;
- }else if (products.equals("beer")){
- productPrice = 1.15;
- }else if (products.equals("sweet")){
- productPrice = 1.3;
- }else if (products.equals("peanuts")){
- productPrice = 1.5;
- }
- }else if (town.equals("varna")){
- if (products.equals("coffee")){
- productPrice = 0.45;
- }else if (products.equals("water")){
- productPrice = 0.7;
- }else if (products.equals("beer")){
- productPrice = 1.1;
- }else if (products.equals("sweets")){
- productPrice = 1.35;
- }else if (products.equals("peanuts")){
- productPrice = 1.55;
- }
- }
- double total = quantity * productPrice;
- System.out.printf("%.2f", total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement