Advertisement
MladenKarachanov

EnergyBooster

Nov 14th, 2023
590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.62 KB | None | 0 0
  1. package ProgrammingBasics2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class EnergyBooster {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String fruit = scanner.nextLine();
  10.         String sizeSet = scanner.nextLine();
  11.         int numSet = Integer.parseInt(scanner.nextLine());
  12.  
  13.         double price = 0;
  14.         double discount = 0;
  15.         if (fruit.equals("Watermelon")) {
  16.             if (sizeSet.equals("small")) {
  17.                 price = numSet * 56 * 2;
  18.  
  19.             } else if (sizeSet.equals("big")) {
  20.                 price = numSet * 28.70 * 5;
  21.             }
  22.  
  23.         } else if (fruit.equals("Mango")) {
  24.             if (sizeSet.equals("small")) {
  25.                 price = numSet * 36.66 * 2;
  26.             } else if (sizeSet.equals("big")) {
  27.                 price = numSet * 19.60 * 5;
  28.             }
  29.         } else if (fruit.equals("Pineapple")) {
  30.             if (sizeSet.equals("small")) {
  31.                 price = numSet * 42.10 * 2;
  32.             } else if (sizeSet.equals("big")) {
  33.                 price = numSet * 24.80 * 5;
  34.             }
  35.         } else if (fruit.equals("Raspberry")) {
  36.             if (sizeSet.equals("small")) {
  37.                 price = numSet * 20 * 2;
  38.             } else if (sizeSet.equals("big")) {
  39.                 price = numSet * 15.20 * 5;
  40.             }
  41.  
  42.         }
  43.         if (numSet >= 400 && numSet <= 1000) {
  44.             price = price - (price*0.15);
  45.  
  46.         }
  47.         if (numSet > 1000) {
  48.             price = price - (price*0.50);
  49.  
  50.         }
  51.  
  52.         System.out.printf("%.2f lv.", price);
  53.     }
  54. }
  55.  
  56. //НЕ Е РЕШЕНА
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement