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();
- int Flowers = Chrysanthemums + Roses + Tulips;
- double PriceChrys = 0;
- double PriceRoses = 0;
- double PriceTulips = 0;
- double DiscountOne = 0;
- double DiscountTwoo = 0;
- double DiscountTree = 0;
- double TotalChrys = 0;
- double TotalRoses = 0;
- double TotalTulips = 0;
- double PriceFlowers = 0;
- double TotalFlowers = 0;
- if (Season.equals("Spring") || Season.equals("Summer"))
- {
- PriceChrys = 2.00;
- PriceRoses = 4.10;
- PriceTulips = 2.50;
- }
- else if (Season.equals("Autumn") ||Season.equals("Winter"))
- {
- PriceChrys = 3.75;
- PriceRoses = 4.50;
- PriceTulips = 4.15;
- }
- TotalChrys = Chrysanthemums * PriceChrys;
- TotalRoses = Roses * PriceRoses;
- TotalTulips = Tulips * PriceTulips;
- PriceFlowers = TotalChrys + TotalRoses + TotalTulips;
- if (Holiday.equals("Y"))
- PriceFlowers = PriceFlowers * 1.15;
- if (Tulips > 7 && Season.equals("Spring"))
- DiscountOne = 0.05 * PriceFlowers;
- PriceFlowers = PriceFlowers - DiscountOne;
- if (Roses >= 10 && Season.equals("Winter"))
- DiscountTwoo = 0.10 * PriceFlowers;
- PriceFlowers = PriceFlowers - DiscountTwoo;
- if (Flowers > 20)
- DiscountTree = 0.2 * PriceFlowers;
- PriceFlowers = PriceFlowers - DiscountTree;
- TotalFlowers = PriceFlowers + 2;
- System.out.printf("%.2f",TotalFlowers);
- }
- }
Add Comment
Please, Sign In to add comment