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 priceAll = 0;
- switch (day) {
- case "Y":
- if ("Spring".equals(season) || "Summer".equals(season)) {
- priceAll = countOfChrysanthemum * 2.00 + countOfRoses * 4.10 + countOfTulips * 2.50;
- priceAll = priceAll + (priceAll * 0.15);
- if (countOfTulips > 7) {
- priceAll = priceAll - (priceAll * 0.05);
- }
- } else if ("Winter".equals(season) || "Autumn".equals(season)) {
- priceAll = countOfChrysanthemum * 3.75 + countOfRoses * 4.50 + countOfTulips * 4.15;
- priceAll = priceAll + (priceAll * 0.15);
- if (countOfRoses >= 10) {
- priceAll = priceAll - (priceAll * 0.10);
- }
- }
- break;
- case "N":
- if ("Spring".equals(season) || "Summer".equals(season)) {
- priceAll = countOfChrysanthemum * 2.00 + countOfRoses * 4.10 + countOfTulips * 2.50;
- if (countOfTulips > 7) {
- priceAll = priceAll - (priceAll * 0.05);
- }
- } else if ("Winter".equals(season) || "Autumn".equals(season)) {
- priceAll = countOfChrysanthemum * 3.75 + countOfRoses * 4.50 + countOfTulips * 4.15;
- if (countOfRoses >= 10) {
- priceAll = priceAll - (priceAll * 0.10);
- }
- }
- break;
- }
- if (countOfChrysanthemum + countOfRoses + countOfTulips > 20) {
- priceAll = (priceAll - (priceAll * 0.20)) + 2;
- } else {
- priceAll = priceAll + 2;
- }
- System.out.printf("%.2f", priceAll);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement