Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.73 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class test3 {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         String fruit = scan.nextLine();
  8.         String size = scan.nextLine();
  9.         int numberOrders = Integer.parseInt(scan.nextLine());
  10.         double price = 0.0;
  11.  
  12.  
  13.         switch (fruit) {
  14.             case "Watermelon":
  15.                 if ("small".equals(size)) {
  16.                     price = 2 * 56.00; // за брой
  17.                 } else if ("big".equals(size)) {
  18.                     price = 5 * 28.70;
  19.                 }
  20.                 break;
  21.         }
  22.         switch (fruit) {
  23.             case "Mango":
  24.                 if ("small".equals(size)) {
  25.                     price = 2 * 36.66; // за брой
  26.                 } else if ("big".equals(size)) {
  27.                     price = 5 * 19.60;
  28.                 }
  29.                 break;
  30.         }
  31.         switch (fruit) {
  32.             case "Pineapple":
  33.                 if ("small".equals(size)) {
  34.                     price = 2 * 42.10; // за брой
  35.                 } else if ("big".equals(size)) {
  36.                     price = 5 * 24.80;
  37.                 }
  38.                 break;
  39.         }
  40.         switch (fruit) {
  41.             case "Raspberry":
  42.                 if ("small".equals(size)) {
  43.                     price = 2 * 20; // за брой
  44.                 } else if ("big".equals(size)) {
  45.                     price = 5 * 15.20;
  46.                 }
  47.                 break;
  48.         }
  49.  
  50.  
  51.         double totalPrice = price * numberOrders;
  52.  
  53.         if (totalPrice >= 400 && totalPrice <= 1000) {
  54.             totalPrice = totalPrice * 0.85;
  55.         }
  56.  
  57.         System.out.printf("%.2f lv.", totalPrice);
  58.  
  59.  
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement