Advertisement
Guest User

Untitled

a guest
May 12th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.45 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Flowers {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int countOfChrysanthemum = Integer.parseInt(scanner.nextLine());
  7.         int countOfRoses = Integer.parseInt(scanner.nextLine());
  8.         int countOfTulips = Integer.parseInt(scanner.nextLine());
  9.         String season = scanner.nextLine();
  10.         String day = scanner.nextLine();
  11.         double springSummerPrice = countOfChrysanthemum * 2.00 + countOfRoses * 4.10 + countOfTulips * 2.50;
  12.         double autumnWinterPrice = countOfChrysanthemum * 3.75 + countOfRoses * 4.50 + countOfTulips * 4.15;
  13.         double priceAll = 0;
  14.  
  15.         if ("Spring".equals(season) || "Summer".equals(season)) {
  16.             priceAll = springSummerPrice;
  17.  
  18.         } else if ("Autumn".equals(season) || "Winter".equals(season)) {
  19.             priceAll = autumnWinterPrice;
  20.  
  21.         }
  22.         if (day.equals("Y")) {
  23.             priceAll = priceAll + (priceAll * 0.15);
  24.         }
  25.         if (countOfTulips > 7 && season.equals("Spring")) {
  26.             priceAll = priceAll - (priceAll * 0.05);
  27.         }
  28.         if (countOfRoses >= 10 && season.equals("Winter")) {
  29.             priceAll = priceAll - (priceAll * 0.10);
  30.         }
  31.         if ((countOfChrysanthemum + countOfRoses + countOfTulips > 20)) {
  32.             priceAll = priceAll - (priceAll * 0.20);
  33.         }
  34.         System.out.printf("%.2f", priceAll + 2);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement