Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- 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 yOrN = scanner.nextLine();
- double totalPrice = 0;
- if (season.equalsIgnoreCase("Spring")) {
- totalPrice = (chrysanthemums * 2.00) + (roses * 4.10) + (tulips * 2.50);
- if (tulips > 7) {
- totalPrice *= 0.95;
- }
- } else if (season.equalsIgnoreCase("Summer")) {
- totalPrice = (chrysanthemums * 2.00) + (roses * 4.10) + (tulips * 2.50);
- } else if (season.equalsIgnoreCase("Autumn")) {
- totalPrice = (chrysanthemums * 3.75) + (roses * 4.50) + (tulips * 4.15);
- } else if (season.equalsIgnoreCase("Winter")) {
- totalPrice = (chrysanthemums * 3.75) + (roses * 4.50) + (tulips * 4.15);
- if (roses >= 10) {
- totalPrice *= 0.90;
- }
- }
- if (yOrN.equalsIgnoreCase("Y")) {
- totalPrice = totalPrice * 1.15;
- }
- double totalCountFlowers = chrysanthemums + roses + tulips;
- if (totalCountFlowers > 20) {
- totalPrice *= 0.80;
- }
- System.out.printf("%.2f", totalPrice + 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement