Advertisement
SUni2020

Flowers

Mar 28th, 2020
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Flowers {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int hrizantems = Integer.parseInt(scanner.nextLine());
  8. int rozes = Integer.parseInt(scanner.nextLine());
  9. int tulips = Integer.parseInt(scanner.nextLine());
  10. String season = scanner. nextLine().toLowerCase();
  11. String holiday = scanner. nextLine().toLowerCase();
  12.  
  13. double totalPrice = 1;
  14. double totalFlowers = hrizantems + rozes + tulips;
  15.  
  16. if (season.equals("spring") || season.equals("summer"))
  17. {
  18. double priceHrizantems = hrizantems * 2.00;
  19. double priceRozes = rozes * 4.10;
  20. double priceTulips = tulips * 2.50;
  21. if (holiday.equals("y"))
  22. {
  23. totalPrice = (priceHrizantems + priceRozes + priceTulips) * 1.15;
  24. }
  25. else
  26. {
  27. totalPrice = priceHrizantems + priceRozes + priceTulips;
  28. }
  29. if (tulips > 7)
  30. {
  31. totalPrice *= 0.95;
  32. }
  33. }
  34. else
  35. {
  36. double priceHrizantems = hrizantems * 3.75;
  37. double priceRozes = rozes * 4.50;
  38. double priceTulips = tulips * 4.15;
  39. if (holiday.equals("y"))
  40. {
  41. totalPrice = (priceHrizantems + priceRozes + priceTulips) * 1.15;
  42. }
  43. else
  44. {
  45. totalPrice = priceHrizantems + priceRozes + priceTulips;
  46. }
  47. if (rozes >= 10 && season.equals("winter"))
  48. {
  49. totalPrice *= 0.90;
  50. }
  51.  
  52. }
  53. if (totalFlowers > 20)
  54. {
  55. totalPrice *= 0.80;
  56. }
  57.  
  58. double arranging = totalPrice + 2.00;
  59. System.out.printf("%.2f",arranging);
  60. }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement