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