Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Flowers {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int countOfChrysanthemum = Integer.parseInt(scanner.nextLine());
- int countOfRoses = Integer.parseInt(scanner.nextLine());
- int countOfTulips = Integer.parseInt(scanner.nextLine());
- String season = scanner.nextLine();
- String day = scanner.nextLine();
- double springSummerPrice = countOfChrysanthemum * 2.00 + countOfRoses * 4.10 + countOfTulips * 2.50;
- double autumnWinterPrice = countOfChrysanthemum * 3.75 + countOfRoses * 4.50 + countOfTulips * 4.15;
- double priceAll = 0;
- if ("Spring".equals(season) || "Summer".equals(season)) {
- priceAll = springSummerPrice;
- } else if ("Autumn".equals(season) || "Winter".equals(season)) {
- priceAll = autumnWinterPrice;
- }
- if (day.equals("Y")) {
- priceAll = priceAll + (priceAll * 0.15);
- }
- if (countOfTulips > 7 && season.equals("Spring")) {
- priceAll = priceAll - (priceAll * 0.05);
- }
- if (countOfRoses >= 10 && season.equals("Winter")) {
- priceAll = priceAll - (priceAll * 0.10);
- }
- if ((countOfChrysanthemum + countOfRoses + countOfTulips > 20)) {
- priceAll = priceAll - (priceAll * 0.20);
- }
- System.out.printf("%.2f", priceAll + 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement