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 chrysanthemums = Integer.parseInt(scanner.nextLine());
- int roses = Integer.parseInt(scanner.nextLine());
- int tulips = Integer.parseInt(scanner.nextLine());
- String season = scanner.nextLine();
- String holiday = scanner.nextLine();
- double sum = 0;
- if (season.equals("Spring") || season.equals("Summer")) {
- sum = 2.00 * chrysanthemums + 4.10 * roses + 2.50 * tulips;
- } else if (season.equals("Autumn") || season.equals("Winter")) {
- sum = 3.75 * chrysanthemums + 4.5 * roses + 4.15 * tulips;
- }
- if (holiday.equals("Y")) {
- sum *= 1.15;
- }
- if (tulips > 7 && season.equals("Spring")) {
- sum *= 0.95;
- }
- if (roses >= 10 && season.equals("Winter")) {
- sum *= 0.90;
- }
- if (chrysanthemums + roses + tulips > 20) {
- sum *= 0.80;
- }
- System.out.printf("%.2f\n", sum + 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement