desislava_topuzakova

Untitled

Feb 28th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Flowers{
  3. public static void main(String[] args) {
  4.  
  5.  
  6. Scanner scanner=new Scanner(System.in);
  7.  
  8. int Chrysanthemums = Integer.parseInt(scanner.nextLine());
  9. int Roses = Integer.parseInt(scanner.nextLine());
  10. int Tulips = Integer.parseInt(scanner.nextLine());
  11. String Season = scanner.nextLine();
  12. String Holiday = scanner.nextLine();
  13. int Flowers = Chrysanthemums + Roses + Tulips;
  14. double PriceChrys = 0;
  15. double PriceRoses = 0;
  16. double PriceTulips = 0;
  17. double DiscountOne = 0;
  18. double DiscountTwoo = 0;
  19. double DiscountTree = 0;
  20. double TotalChrys = 0;
  21. double TotalRoses = 0;
  22. double TotalTulips = 0;
  23. double PriceFlowers = 0;
  24. double TotalFlowers = 0;
  25. if (Season.equals("Spring") || Season.equals("Summer"))
  26. {
  27. PriceChrys = 2.00;
  28. PriceRoses = 4.10;
  29. PriceTulips = 2.50;
  30. }
  31. else if (Season.equals("Autumn") ||Season.equals("Winter"))
  32. {
  33. PriceChrys = 3.75;
  34. PriceRoses = 4.50;
  35. PriceTulips = 4.15;
  36. }
  37. TotalChrys = Chrysanthemums * PriceChrys;
  38. TotalRoses = Roses * PriceRoses;
  39. TotalTulips = Tulips * PriceTulips;
  40. PriceFlowers = TotalChrys + TotalRoses + TotalTulips;
  41. if (Holiday.equals("Y"))
  42. PriceFlowers = PriceFlowers * 1.15;
  43. if (Tulips > 7 && Season.equals("Spring"))
  44. DiscountOne = 0.05 * PriceFlowers;
  45. PriceFlowers = PriceFlowers - DiscountOne;
  46. if (Roses >= 10 && Season.equals("Winter"))
  47. DiscountTwoo = 0.10 * PriceFlowers;
  48. PriceFlowers = PriceFlowers - DiscountTwoo;
  49. if (Flowers > 20)
  50. DiscountTree = 0.2 * PriceFlowers;
  51. PriceFlowers = PriceFlowers - DiscountTree;
  52. TotalFlowers = PriceFlowers + 2;
  53. System.out.printf("%.2f",TotalFlowers);
  54. }
  55. }
Add Comment
Please, Sign In to add comment