Advertisement
galinyotsev123

ProgBasicsExam12January2019-03FlowerShop

Jan 26th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int chrysanthemums = Integer.parseInt(scanner.nextLine());
  8. int roses = Integer.parseInt(scanner.nextLine());
  9. int tulips = Integer.parseInt(scanner.nextLine());
  10. String season = scanner.nextLine();
  11. String yOrN = scanner.nextLine();
  12. double totalPrice = 0;
  13.  
  14. if (season.equalsIgnoreCase("Spring")) {
  15. totalPrice = (chrysanthemums * 2.00) + (roses * 4.10) + (tulips * 2.50);
  16. if (tulips > 7) {
  17. totalPrice *= 0.95;
  18. }
  19. } else if (season.equalsIgnoreCase("Summer")) {
  20. totalPrice = (chrysanthemums * 2.00) + (roses * 4.10) + (tulips * 2.50);
  21. } else if (season.equalsIgnoreCase("Autumn")) {
  22. totalPrice = (chrysanthemums * 3.75) + (roses * 4.50) + (tulips * 4.15);
  23. } else if (season.equalsIgnoreCase("Winter")) {
  24. totalPrice = (chrysanthemums * 3.75) + (roses * 4.50) + (tulips * 4.15);
  25. if (roses >= 10) {
  26. totalPrice *= 0.90;
  27. }
  28. }
  29.  
  30. if (yOrN.equalsIgnoreCase("Y")) {
  31. totalPrice = totalPrice * 1.15;
  32. }
  33. double totalCountFlowers = chrysanthemums + roses + tulips;
  34.  
  35. if (totalCountFlowers > 20) {
  36. totalPrice *= 0.80;
  37. }
  38.  
  39. System.out.printf("%.2f", totalPrice + 2);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement