yovkovbpfps

EXAM 22 - 23 DECEMBER 2018 - Pastry Shop

Apr 26th, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PaintingEggs {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String typeSweet = scanner.nextLine();
  8. int count = Integer.parseInt(scanner.nextLine());
  9. int day = Integer.parseInt(scanner.nextLine());
  10.  
  11. double priceForOne = 0;
  12. if (day<=15)
  13. {
  14. switch (typeSweet) {
  15. case "Cake":
  16. priceForOne = 24;
  17. break;
  18. case "Souffle":
  19. priceForOne = 6.66;
  20. break;
  21. case "Baklava":
  22. priceForOne = 12.60;
  23. break;
  24. }
  25. }
  26. else
  27. {
  28. switch (typeSweet)
  29. {
  30. case "Cake":
  31. priceForOne = 28.70;
  32. break;
  33. case "Souffle":
  34. priceForOne = 9.80;
  35. break;
  36. case "Baklava":
  37. priceForOne = 16.98;
  38. break;
  39. }
  40. }
  41.  
  42. double totalPrice = priceForOne * count;
  43.  
  44. if (day<=22)
  45. {
  46. if (totalPrice>=100&&totalPrice<=200)
  47. {
  48. totalPrice = totalPrice - (totalPrice * 0.15);
  49. }
  50. else if (totalPrice > 200)
  51. {
  52. totalPrice = totalPrice - (totalPrice * 0.25);
  53. }
  54. }
  55. if (day <= 15)
  56. {
  57. totalPrice = totalPrice - (totalPrice * 0.10);
  58. }
  59.  
  60. System.out.printf("%.2f",totalPrice);
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment