Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class test3 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String fruit = scan.nextLine();
- String size = scan.nextLine();
- int numberOrders = Integer.parseInt(scan.nextLine());
- double price = 0.0;
- switch (fruit) {
- case "Watermelon":
- if ("small".equals(size)) {
- price = 2 * 56.00; // за брой
- } else if ("big".equals(size)) {
- price = 5 * 28.70;
- }
- break;
- }
- switch (fruit) {
- case "Mango":
- if ("small".equals(size)) {
- price = 2 * 36.66; // за брой
- } else if ("big".equals(size)) {
- price = 5 * 19.60;
- }
- break;
- }
- switch (fruit) {
- case "Pineapple":
- if ("small".equals(size)) {
- price = 2 * 42.10; // за брой
- } else if ("big".equals(size)) {
- price = 5 * 24.80;
- }
- break;
- }
- switch (fruit) {
- case "Raspberry":
- if ("small".equals(size)) {
- price = 2 * 20; // за брой
- } else if ("big".equals(size)) {
- price = 5 * 15.20;
- }
- break;
- }
- double totalPrice = price * numberOrders;
- if (totalPrice >= 400 && totalPrice <= 1000) {
- totalPrice = totalPrice * 0.85;
- }
- System.out.printf("%.2f lv.", totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement