A_Marinov

Problem_03

Jun 7th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.31 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class HoneyHarvest_03 {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         String flowerType = scan.nextLine();
  8.         int flowersCount = Integer.parseInt(scan.nextLine());
  9.         String season = scan.nextLine();
  10.  
  11.         double honey = 0;
  12.         switch (flowerType) {
  13.             case "Sunflower":
  14.                 if (season.equals("Spring")) {
  15.                     honey = flowersCount * 10;
  16.                 } else if (season.equals("Summer")) {
  17.                     honey = flowersCount * 8;
  18.                     honey = honey * 1.1;
  19.                 } else if (season.equals("Autumn")) {
  20.                     honey = flowersCount * 12;
  21.                     honey = honey * 0.95;
  22.                 }
  23.                 break;
  24.             case "Daisy":
  25.                 if (season.equals("Spring")) {
  26.                     honey = flowersCount * 12;
  27.                     honey = honey * 1.1;
  28.                 } else if (season.equals("Summer")) {
  29.                     honey = flowersCount * 8;
  30.                     honey = honey * 1.1;
  31.                 } else if (season.equals("Autumn")) {
  32.                     honey = flowersCount * 6;
  33.                     honey = honey * 0.95;
  34.                 }
  35.                 break;
  36.             case "Lavender":
  37.                 if (season.equals("Spring")) {
  38.                     honey = flowersCount * 12;
  39.                 } else if (season.equals("Summer")) {
  40.                     honey = flowersCount * 8;
  41.                     honey = honey * 1.1;
  42.                 } else if (season.equals("Autumn")) {
  43.                     honey = flowersCount * 6;
  44.                     honey = honey * 0.95;
  45.                 }
  46.                 break;
  47.             case "Mint":
  48.                 if (season.equals("Spring")) {
  49.                     honey = flowersCount * 10;
  50.                     honey = honey * 1.1;
  51.                 } else if (season.equals("Summer")) {
  52.                     honey = flowersCount * 12;
  53.                     honey = honey * 1.1;
  54.                 } else if (season.equals("Autumn")) {
  55.                     honey = flowersCount * 6;
  56.                     honey = honey * 0.95;
  57.                 }
  58.                 break;
  59.         }
  60.         System.out.printf("Total honey harvested: %.2f", honey);
  61.     }
  62. }
Add Comment
Please, Sign In to add comment