menu.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. var propose = [
  2. scrambleEggs = {
  3. name: "Scramble eggs",
  4. products: ["7 eggs", " 200gr of bacon"],
  5. price: 45,
  6. },
  7. omelette = {
  8. name: "Omelette",
  9. products: ["7 eggs "," 200gr of champinions "],
  10. price: 45,
  11. },
  12. boilOmelette = {
  13. name: "Boil omelette",
  14. products: ["7 eggs", " 200ml of milk "," 200gr of cheese"],
  15. price: 60,
  16. },
  17. sweetOatmeal = {
  18. name: "Sweet oatmeal",
  19. products: ["300gr of oarmeal", " 1 banana", " a bit of honey"],
  20. price: 40,
  21. },
  22. saltyOatmeal = {
  23. name: "Salty oatmeal",
  24. products: ["300gr of oatmeal", " 200gr of roast meat", " a bit of salt"],
  25. price: 40,
  26. },
  27. lazyOatmeal = {
  28. name: "Lazy oatmeal",
  29. products: ["300gr of oatmeal", " 400ml of milk", "some berries"],
  30. price: 60,
  31. },
  32. hotCheezTosts = {
  33. name: "Hot tosts with Cheese",
  34. products: ["bread", " 150gr of sausage" , " sauce", " 200gr of cheese"],
  35. price: 45,
  36. },
  37. hotTosts = {
  38. name: "Hot tosts with eggs",
  39. products: ["bread", " 3 eggs", "sauce", " 200gr of cheese"],
  40. price: 35,
  41. },
  42. fishTosts = {
  43. name: "Tosts with salmon",
  44. products: ["bread", " 200gr of salmon", "butter"],
  45. price: 60,
  46. }
  47. ];
  48. var Cost = 0;
  49. function Choose() {
  50. var recepy;
  51. var result = prompt("Do you want choose breakfast for your family?");
  52. if (result == "yes") {
  53. var chosen = Math.floor(Math.random() * propose.length);
  54. for (var i = 0; i <= chosen; i++) {
  55. if (chosen == i) {
  56. recepy = propose[chosen];
  57. }
  58. }
  59. alert ("Your chose is " + recepy.name);
  60. alert ("You're need " + recepy.products)
  61. function Meal (trying) {
  62. trying = prompt ("Do you like this");
  63. if (trying == "yes") {
  64. alert ("Great!")
  65. Cost = Cost + recepy.price
  66. alert ("Good luck on your kitchen with " + recepy.name)
  67. wantAgain = prompt ("Do you want something else for a breakfast?");
  68. if (wantAgain == "yes") {
  69. alert ("Great!")
  70. return Choose()
  71. }
  72. else if (wantAgain == "no") {
  73. return alert ("Ok")
  74. }
  75. }
  76. else if (trying == "no") {
  77. alert ("No problem! Let's try again!")
  78. return Choose()
  79. }
  80. else {
  81. alert ("Sorry, I can't unserstad. Please, say yes or no")
  82. return Meal ()
  83. }
  84. }
  85. Meal();
  86. }
  87. else if (result == "no") {
  88. return alert ("Ok! See you next time!")
  89. }
  90. else {
  91. alert ("Please, say yes or no")
  92. return Choose()
  93. }
  94. alert("Yout meal costs " + Cost + "UAH")
  95. }
  96. Choose()