Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PROBA {
- 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 ("sofia".equals(town)){
- if ("coffee".equals(products)){
- productPrice = 0.5;
- }else if ("water".equals(products)){
- productPrice = 0.8;
- }else if ("beer".equals(products)){
- productPrice = 1.2;
- }else if ("sweets".equals(products)){
- productPrice = 1.45;
- }else if ("peanuts".equals(products)){
- productPrice = 1.6;
- }
- }else if ("plovdiv".equals(town)){
- if ("coffee".equals(products)){
- productPrice = 0.4;
- }else if ("water".equals(products)){
- productPrice = 0.7;
- }else if ("beer".equals(products)){
- productPrice = 1.15;
- }else if ("sweets".equals(products)){
- productPrice = 1.3;
- }else if ("peanuts".equals(products)){
- productPrice = 1.5;
- }
- }else if ("varna".equals(town)){
- if ("coffee".equals(products)){
- productPrice = 0.45;
- }else if ("water".equals(products)){
- productPrice = 0.7;
- }else if ("beer".equals(products)){
- productPrice = 1.1;
- }else if ("sweets".equals(products)){
- productPrice = 1.35;
- }else if ("peanuts".equals(products)){
- productPrice = 1.55;
- }
- }
- double total = quantity * productPrice;
- System.out.printf("%.2f", total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement