From 01ec7818c28f4ba5e341c3579a3b2444cad4ca37 Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Wed, 4 Sep 2024 14:18:32 +0200 Subject: [PATCH 01/15] Changed title, h1 and added styling and the first promt --- code/index.html | 6 +++--- code/script.js | 34 +++++++++++++++++++++++++++++----- code/style.css | 4 ++-- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/code/index.html b/code/index.html index f7844d6b..96eb9ceb 100644 --- a/code/index.html +++ b/code/index.html @@ -3,7 +3,7 @@ - Javascript Pizzeria + MamaMia Pizzeria -

Javascript Pizzeria

-

Logic is executed automatically

+

MamaMia Pizzeria

+

Pizza, Pasta and Salads

diff --git a/code/script.js b/code/script.js index 34ca0f34..ec38466b 100644 --- a/code/script.js +++ b/code/script.js @@ -3,17 +3,41 @@ // Step 1 - Welcome and introduction // Your code goes here alert( - `Welcome to our Javascript Pizzeria. Ready to Start? - Click 'OK' to begin.` + `Welcome to MamaMia Pizzeria. Ready to order? - Click 'OK' to begin.` +) + +// Step 2 - What is your name? + +const name = prompt("What's your name?") +console.log('user name is:', name) + +alert(`Thank you for choosing our restaurant, ${name}! We’re here to make your experience memorable.`); + + // Step 3 - What type of food + +// const mealchoice = prompt ( + +// ("What would you like to eat? Choose the dish number 1, 2 or 3 according to below" + +// 1.Pizza +// 2. Pasta +// 3. Salad + +// if (number === 1) +// console.log("Pizza"); +// ) + + +alert ( + "You have choosen, ${food choice}" ) -// Step 2 - Food choice -// Your code goes here // Step 3 - Subtype choice -// Your code goes here + // Step 4 - Age // Your code goes here // Step 5 - Order confirmation -// Your code goes here +// Your code goes here \ No newline at end of file diff --git a/code/style.css b/code/style.css index d384d122..65c10b3a 100644 --- a/code/style.css +++ b/code/style.css @@ -6,7 +6,7 @@ body { font-family: "Montserrat", sans-serif; - background: #0026ff; + background: linear-gradient(135deg, rgb(8, 163, 39) 60%, rgb(255, 0, 0)); color: white; display: flex; justify-content: center; @@ -17,4 +17,4 @@ body { p { font-size: 1.5em; -} +} \ No newline at end of file From 1b116a842b38d61464cfe653471d97848ba2905b Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Wed, 4 Sep 2024 15:04:14 +0200 Subject: [PATCH 02/15] added more prompts and alerts for the different kinds of food --- code/script.js | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/code/script.js b/code/script.js index ec38466b..b3d567b2 100644 --- a/code/script.js +++ b/code/script.js @@ -9,29 +9,44 @@ alert( // Step 2 - What is your name? const name = prompt("What's your name?") -console.log('user name is:', name) +console.log('name is:', name) alert(`Thank you for choosing our restaurant, ${name}! We’re here to make your experience memorable.`); // Step 3 - What type of food -// const mealchoice = prompt ( - -// ("What would you like to eat? Choose the dish number 1, 2 or 3 according to below" +const mealchoice = prompt (`What would you like to eat? Choose the dish number 1, 2 or 3 according to below" -// 1.Pizza -// 2. Pasta -// 3. Salad - -// if (number === 1) -// console.log("Pizza"); -// ) +1. Pizza +2. Pasta +3. Salad +` +) +if (mealchoice === "1") { alert ( - "You have choosen, ${food choice}" + `Thank you ${name},you have chosen nr 1, Pizza` ) +} else if (mealchoice === "2") { + alert ( + `Thank you ${name} you have chosen nr 2, Pasta` + ) + +} else if (mealchoice === "3") { + alert ( + `Thank you ${name} you have chosen nr 3, Salad` + ) + +} else { + alert ( + `I´m sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3` + ) +} + + + // Step 3 - Subtype choice From 0271747b709ad84c4dc24d5e81471a9ea2818402 Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Wed, 4 Sep 2024 21:22:43 +0200 Subject: [PATCH 03/15] added subchoices for pizza, pasta and sallad as well as alerts --- code/index.html | 4 +- code/script.js | 172 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 145 insertions(+), 31 deletions(-) diff --git a/code/index.html b/code/index.html index 96eb9ceb..4bed4a94 100644 --- a/code/index.html +++ b/code/index.html @@ -3,7 +3,7 @@ - MamaMia Pizzeria + Mama Mia Pizzeria -

MamaMia Pizzeria

+

Mama Mia Pizzeria

Pizza, Pasta and Salads

diff --git a/code/script.js b/code/script.js index b3d567b2..f6a1b7a8 100644 --- a/code/script.js +++ b/code/script.js @@ -2,57 +2,171 @@ // Step 1 - Welcome and introduction // Your code goes here -alert( - `Welcome to MamaMia Pizzeria. Ready to order? - Click 'OK' to begin.` + +alert ( + `Welcome to Mama Mia Pizzeria. Ready to order? - Click 'OK' to begin.` ) +const name = prompt(`What's your name?`) -// Step 2 - What is your name? +alert( + + `Thank you for choosing our restaurant, ${name}! We’re here to make your experience memorable.` +); -const name = prompt("What's your name?") -console.log('name is:', name) +// Step 2 - What type of food +const mealchoice = prompt( + + `What would you like to eat? Choose the dish number 1, 2 or 3 according to below: -alert(`Thank you for choosing our restaurant, ${name}! We’re here to make your experience memorable.`); + 1. Pizza + 2. Pasta + 3. Salad +` +) - // Step 3 - What type of food +if (mealchoice === "1") { + + alert( + + `Thank you ${name}, you have chosen no 1, Pizza` + +) -const mealchoice = prompt (`What would you like to eat? Choose the dish number 1, 2 or 3 according to below" + // Step 3 - Subtype choice for Pizza + const pizzatype = prompt( + + `What kind of Pizza would you like? Choose between no 1, 2 or 3 according to below: -1. Pizza -2. Pasta -3. Salad -` + 1. Capricciosa + 2. Hawaii + 3. Kebab pizza + ` ) -if (mealchoice === "1") { + if (pizzatype === "1") { -alert ( - `Thank you ${name},you have chosen nr 1, Pizza` + alert( + + `Thank you ${name}, you have chosen no 1, Capricciosa. Love your choice!` + +) + } else if (pizzatype === "2") { + + alert( + + `Thank you ${name}, you have chosen no 2, Hawaii. Aloha!` ) + } else if (pizzatype === "3") { + + alert( + + `Thank you ${name}, you have chosen no 3, Kebab pizza. Great choice!` + +) + } else { + + alert( + + `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` +) + } } else if (mealchoice === "2") { - alert ( - `Thank you ${name} you have chosen nr 2, Pasta` - ) + alert( + + `Thank you ${name}, you have chosen no 2, Pasta` + +) + + // Step 3 - Subtype choice for Pasta + const pastatype = prompt( + + `What kind of pasta would you like? Choose between no 1, 2 or 3 according to below: + + 1. Bolognese + 2. Carbonara + 3. Lasagna + ` +) + + if (pastatype === "1") { + alert( + + `Thank you ${name}, you have chosen no 1, Bolognese. Great choice!` +) + } else if (pastatype === "2") { + + alert( + + `Thank you ${name}, you have chosen no 2, Carbonara. Splendido!` +) + } else if (pastatype === "3") { + alert( + + `Thank you ${name}, you have chosen no 3, Lasagna. Delicious choice!` +) + } else { + + alert( + + `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` +) + } } else if (mealchoice === "3") { - alert ( - `Thank you ${name} you have chosen nr 3, Salad` - ) + + alert( -} else { - alert ( - `I´m sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3` - ) -} + `Thank you ${name}, you have chosen no 3, Salad` +) + // Step 3 - Subtype choice for Salad + const saladtype = prompt( + + ` What kind of salad would you like? Choose between no 1, 2 or 3 according to below: - + 1. Caesar salad + 2. Greek salad + 3. Ham & cheese salad + ` +) + + if (saladtype === "1") { + + alert( + + `Thank you ${name}, you have chosen no 1, Caesar salad. Fresh choice!` + +) + } else if (saladtype === "2") { + + alert( + + `Thank you ${name}, you have chosen no 2, Greek salad. Healthy choice!` +) + } else if (saladtype === "3") { + alert( + + `Thank you ${name}, you have chosen no 3, Ham & cheese salad. Great choice!` + +) + } else { -// Step 3 - Subtype choice + alert( + + `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` + +) + } +} else { + alert( + + `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.`) +} // Step 4 - Age // Your code goes here // Step 5 - Order confirmation -// Your code goes here \ No newline at end of file +// Your code goes here/ // // \ No newline at end of file From 724559e4d181e229b27c819cc9a009d6bb4ff16d Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Fri, 6 Sep 2024 09:30:54 +0200 Subject: [PATCH 04/15] added wile loops with strict equality operators, added rest of the JS input such as age prompt and confirmorder --- code/script.js | 458 +++++++++++++++++++++++++++++++++++++------------ code/style.css | 4 +- 2 files changed, 348 insertions(+), 114 deletions(-) diff --git a/code/script.js b/code/script.js index f6a1b7a8..a8837658 100644 --- a/code/script.js +++ b/code/script.js @@ -1,172 +1,404 @@ -// Start here +// I have used while loops and let before const, so the variable can change in the loop. I have also assigned empty strings. -// Step 1 - Welcome and introduction -// Your code goes here +// A while loop is a control flow structure in programming that repeatedly executes a block of code as long as a given condition evaluates to true. The condition is checked before each iteration of the loop, and if the condition is false, the loop terminates. -alert ( - `Welcome to Mama Mia Pizzeria. Ready to order? - Click 'OK' to begin.` -) -const name = prompt(`What's your name?`) -alert( - - `Thank you for choosing our restaurant, ${name}! We’re here to make your experience memorable.` -); +alert(`Welcome to Mama Mia Pizzeria. Ready to order? - Click 'OK' to begin.`) + +let userName = prompt(`What's your name?`) + +if (!userName) { + userName = "anonymous" +} +alert(`Thank you for choosing our restaurant, ${userName}! We're here to make your experience memorable.`) + // Step 2 - What type of food -const mealchoice = prompt( - - `What would you like to eat? Choose the dish number 1, 2 or 3 according to below: - 1. Pizza - 2. Pasta - 3. Salad -` -) +// Added while loops to check if the user's input is not one of the valid options by using === (equals) + +let mealchoice = '' +while (!(mealchoice === "1" || mealchoice === "2" || mealchoice === "3")) { + mealchoice = prompt( + + `What would you like to order? Choose the dish number 1, 2 or 3 according to below: + + 1. Pizza + 2. Pasta + 3. Salad + ` + ) +// If none of the valid options (!) are chosen the alert below will show) + + if (!(mealchoice === "1" || mealchoice === "2" || mealchoice === "3")) { + alert(`I'm sorry ${userName}, that is not a valid option. Please choose number 1, 2 or 3.`) + } +} + +let mealType = '' +let subType = '' if (mealchoice === "1") { + mealType = "Pizza" + alert(`Thank you ${userName}, you have chosen no 1, Pizza`) + + // Step 3 - Subtype choice for Pizza. // Added while loops to check if the user's input is not one of the valid options by using === (equals) + let pizzatype = '' + + while (!(pizzatype === "1" || pizzatype === "2" || pizzatype === "3")) { + pizzatype = prompt( + + `What kind of Pizza would you like? Choose between no 1, 2 or 3 according to below: + + 1. Capricciosa + 2. Hawaii + 3. Kebab pizza + ` + ) + + if (pizzatype === "1") { + + subType = "Capricciosa" + alert(`You have chosen no 1, Capricciosa. Love your choice!`) + + } else if (pizzatype === "2") { + subType = "Hawaii" + + alert(`You have chosen no 2, Hawaii. Aloha!`) + } else if (pizzatype === "3") { + + subType = "Kebab pizza" + alert(`You have chosen no 3, Kebab pizza. Great choice!`) + } else { + + alert(`I'm sorry ${userName}, that is not a valid option. Please choose number 1, 2 or 3.`) + } + } + +} else if (mealchoice === "2") { + mealType = "Pasta" + alert(`Thank you ${userName}, you have chosen no 2, Pasta`) + + // Step 3 - Subtype choice for Pasta. // Added while loops to check if the user's input is not one of the valid options by using === (equals) + + let pastatype = "" + + while (!(pastatype === "1" || pastatype === "2" || pastatype === "3")) { + + pastatype = prompt( + `What kind of pasta would you like? Choose between no 1, 2 or 3 according to below: + + 1. Bolognese + 2. Carbonara + 3. Lasagna + ` + ) + + if (pastatype === "1") + { + subType = 'Bolognese' + + alert(`You have chosen no 1, Bolognese. Great choice!`) + + } else if (pastatype === "2") { + subType = 'Carbonara' + + alert(`You have chosen no 2, Carbonara. Splendido!`) + + } else if (pastatype === "3") { + subType = 'Lasagna' + + alert(`You have chosen no 3, Lasagna. Delicious choice!`) + + } else { + alert(`I'm sorry ${userName}, that is not a valid option. Please choose number 1, 2 or 3.`) + } + } + +} else if (mealchoice === "3") { + mealType = "Salad" + + alert(`Thank you ${userName}, you have chosen no 3, Salad`) + + // Step 3 - Subtype choice for Salad + let saladtype = '' + + while (!(saladtype === "1" || saladtype === "2" || saladtype === "3")) { + + saladtype = prompt( + + ` What kind of salad would you like? Choose between no 1, 2 or 3 according to below: + + 1. Caesar + 2. Greek + 3. Ham & cheese + ` + ) + + if (saladtype === "1") { + subType = "Caesar" + + alert (`You have chosen no 1, Caesar salad. Fresh choice!`) + + } else if (saladtype === "2") { + + subType = "Greek" + alert (`You have chosen no 2, Greek salad. Healthy choice!`) + + } else if (saladtype === "3") { + subType = "Ham & cheese" + + alert (`You have chosen no 3, Ham & cheese salad. Great choice!`) + + } else { + alert (`I'm sorry ${userName}, that is not a valid option. Please choose number 1, 2 or 3.`) + } + } +} + +// Step 4 - Portion size // Added while loops to check if the user's input is not one of the valid options by using === (equals) +let age = '' +let portionSize = '' + +while (!(age === "1" || age === "2")) { + age = prompt( + + `Is this order for an adult or child? Please choose corresponding number below. + + 1. Adult + 2. Child + ` + ) + + if (age === "1") { + portionSize = 'adult' + + alert(`You have chosen an adult portion.`) + + } else if (age === "2") { + + portionSize = 'child' + + alert(`You have chosen a child portion.`) + + } else { + + alert (`I'm sorry ${userName}, that is not a valid option. Please choose number 1 or 2.`) + } +} + +// Step 5 - Order confirmation I used confirmOrder.toLowercase to make sure that the user input is not case sensitive. In other words, they can write YES, yes or No, no and it will be valid. + +let confirmOrder = prompt (`Do you confirm the order of ${portionSize} portion, ${subType} ${mealType}? Yes or No`) + +if (confirmOrder.toLowerCase() === "yes") { + + alert(`Thank you for your order, ${userName}! We will start preparing your meal now and we hope you will enjoy the food!`) + +} else { + + alert(`You have declined the order, ${userName}. Please come back again if you want to order another time!`) +} + + + + + + + + + + +// // Start here + +// // Step 1 - Welcome and introduction +// // Your code goes here + +// alert ( +// `Welcome to Mama Mia Pizzeria. Ready to order? - Click 'OK' to begin.` +// ) +// const name = prompt(`What's your name?`) + +// alert( + +// `Thank you for choosing our restaurant, ${name}! We’re here to make your experience memorable.` +// ) + +// // Step 2 - What type of food +// const mealchoice = prompt( + +// `What would you like to order? Choose the dish number 1, 2 or 3 according to below: + +// 1. Pizza +// 2. Pasta +// 3. Salad +// ` +// ) + +// if (mealchoice === "1") { - alert( +// alert( - `Thank you ${name}, you have chosen no 1, Pizza` +// `Thank you ${name}, you have chosen no 1, Pizza` -) +// ) - // Step 3 - Subtype choice for Pizza - const pizzatype = prompt( +// // Step 3 - Subtype choice for Pizza +// const pizzatype = prompt( - `What kind of Pizza would you like? Choose between no 1, 2 or 3 according to below: +// `What kind of Pizza would you like? Choose between no 1, 2 or 3 according to below: - 1. Capricciosa - 2. Hawaii - 3. Kebab pizza - ` -) +// 1. Capricciosa +// 2. Hawaii +// 3. Kebab pizza +// ` +// ) - if (pizzatype === "1") { +// if (pizzatype === "1") { - alert( +// alert( - `Thank you ${name}, you have chosen no 1, Capricciosa. Love your choice!` +// `Thank you ${name}, you have chosen no 1, Capricciosa. Love your choice!` -) - } else if (pizzatype === "2") { +// ) +// } else if (pizzatype === "2") { - alert( +// alert( - `Thank you ${name}, you have chosen no 2, Hawaii. Aloha!` -) - } else if (pizzatype === "3") { +// `Thank you ${name}, you have chosen no 2, Hawaii. Aloha!` +// ) +// } else if (pizzatype === "3") { - alert( +// alert( - `Thank you ${name}, you have chosen no 3, Kebab pizza. Great choice!` +// `Thank you ${name}, you have chosen no 3, Kebab pizza. Great choice!` -) - } else { +// ) +// } else { - alert( +// alert( - `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` -) - } +// `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` +// ) +// } -} else if (mealchoice === "2") { - alert( +// } else if (mealchoice === "2") { +// alert( - `Thank you ${name}, you have chosen no 2, Pasta` +// `Thank you ${name}, you have chosen no 2, Pasta` -) +// ) - // Step 3 - Subtype choice for Pasta - const pastatype = prompt( +// // Step 3 - Subtype choice for Pasta +// const pastatype = prompt( - `What kind of pasta would you like? Choose between no 1, 2 or 3 according to below: +// `What kind of pasta would you like? Choose between no 1, 2 or 3 according to below: - 1. Bolognese - 2. Carbonara - 3. Lasagna - ` -) +// 1. Bolognese +// 2. Carbonara +// 3. Lasagna +// ` +// ) - if (pastatype === "1") { - alert( +// if (pastatype === "1") { +// alert( - `Thank you ${name}, you have chosen no 1, Bolognese. Great choice!` -) - } else if (pastatype === "2") { +// `Thank you ${name}, you have chosen no 1, Bolognese. Great choice!` +// ) +// } else if (pastatype === "2") { - alert( +// alert( - `Thank you ${name}, you have chosen no 2, Carbonara. Splendido!` -) - } else if (pastatype === "3") { - alert( +// `Thank you ${name}, you have chosen no 2, Carbonara. Splendido!` +// ) +// } else if (pastatype === "3") { +// alert( - `Thank you ${name}, you have chosen no 3, Lasagna. Delicious choice!` -) - } else { +// `Thank you ${name}, you have chosen no 3, Lasagna. Delicious choice!` +// ) +// } else { - alert( +// alert( - `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` -) - } +// `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` +// ) +// } -} else if (mealchoice === "3") { +// } else if (mealchoice === "3") { - alert( +// alert( - `Thank you ${name}, you have chosen no 3, Salad` -) +// `Thank you ${name}, you have chosen no 3, Salad` +// ) - // Step 3 - Subtype choice for Salad - const saladtype = prompt( +// // Step 3 - Subtype choice for Salad +// const saladtype = prompt( - ` What kind of salad would you like? Choose between no 1, 2 or 3 according to below: +// ` What kind of salad would you like? Choose between no 1, 2 or 3 according to below: - 1. Caesar salad - 2. Greek salad - 3. Ham & cheese salad - ` -) +// 1. Caesar salad +// 2. Greek salad +// 3. Ham & cheese salad +// ` +// ) - if (saladtype === "1") { +// if (saladtype === "1") { - alert( +// alert( - `Thank you ${name}, you have chosen no 1, Caesar salad. Fresh choice!` +// `Thank you ${name}, you have chosen no 1, Caesar salad. Fresh choice!` -) - } else if (saladtype === "2") { +// ) +// } else if (saladtype === "2") { - alert( +// alert( - `Thank you ${name}, you have chosen no 2, Greek salad. Healthy choice!` -) - } else if (saladtype === "3") { - alert( +// `Thank you ${name}, you have chosen no 2, Greek salad. Healthy choice!` +// ) +// } else if (saladtype === "3") { +// alert( - `Thank you ${name}, you have chosen no 3, Ham & cheese salad. Great choice!` +// `Thank you ${name}, you have chosen no 3, Ham & cheese salad. Great choice!` -) - } else { +// ) +// } else { - alert( +// alert( - `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` +// `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` -) - } +// ) +// } -} else { - alert( +// } else { +// alert( - `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.`) -} +// `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.`) +// } + +// // Step 4 - Age +// // Your code goes here +// const age = prompt( +// `Is this order for an adult or child? Please choose corresponding number below. -// Step 4 - Age -// Your code goes here +// 1. Adult +// 2. Child +// ` +// ) + +// if (age === "1") { + +// alert( + +// `Thank you ${name}, you have ordered an adult portion.` + +// ) + +// } else if (age === "2") { + +// alert( + +// `Thank you ${name}, you have ordered a child portion.` +// ) -// Step 5 - Order confirmation -// Your code goes here/ // // \ No newline at end of file +// } diff --git a/code/style.css b/code/style.css index 65c10b3a..3baaccf1 100644 --- a/code/style.css +++ b/code/style.css @@ -6,8 +6,10 @@ body { font-family: "Montserrat", sans-serif; - background: linear-gradient(135deg, rgb(8, 163, 39) 60%, rgb(255, 0, 0)); + background: linear-gradient(130deg, rgb(8, 163, 39) 55%, white, rgb(255, 0, 0)); color: white; + width: 100%; + height:64px; display: flex; justify-content: center; align-items: center; From 1d14d133f5b7d354b11449644194c50f4e60895f Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Fri, 6 Sep 2024 12:35:45 +0200 Subject: [PATCH 05/15] Changed the first userName prompt to Uppercase, changed som CSS and updated the readme file. --- README.md | 8 +- code/script.js | 207 +------------------------------------------------ code/style.css | 3 +- 3 files changed, 10 insertions(+), 208 deletions(-) diff --git a/README.md b/README.md index 33c7e601..b4f381c4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,14 @@ # Project Name -Replace this readme with your own information about your project. Start by briefly describing the assignment in a sentence or two. Keep it short and to the point. +The project this week, and the first project in sprint 2, our task was to produce a Pizzeria bot. That is a make up-order ## The problem -Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next? +I looked at Damiens video and used his example with the "alarm clock" as a basis. I had problems getting each step to work when I first tried using const instead of let and to move on to the next prompt or alert when making an incorrect input, such as choosing nr 4 instead of 1, 2, 3 which are the available options. Then I googled and asked chat gpt and got the response to use while loops. I tried that with some google help and Matildas instructions on the Thursday session and it worked out well. + +I have used let as variable and while loops to check if the user's input is not one of the valid options by using === strict equality operator. + +If Í hade more time I would try to add more prompts and alerts such as more meal options and add a background image or hero, order button and dig deeper into the JS basics and how to write less code but achieve the same. ## View it live diff --git a/code/script.js b/code/script.js index a8837658..aca26559 100644 --- a/code/script.js +++ b/code/script.js @@ -10,12 +10,12 @@ let userName = prompt(`What's your name?`) if (!userName) { userName = "anonymous" } -alert(`Thank you for choosing our restaurant, ${userName}! We're here to make your experience memorable.`) +alert(`Thank you for choosing our restaurant, ${userName.toUpperCase()}! We're here to make your experience memorable.`) // Step 2 - What type of food -// Added while loops to check if the user's input is not one of the valid options by using === (equals) +// Added while loops to check if the user's input is not one of the valid options by using === ( strict equality operator) let mealchoice = '' while (!(mealchoice === "1" || mealchoice === "2" || mealchoice === "3")) { @@ -199,206 +199,3 @@ if (confirmOrder.toLowerCase() === "yes") { alert(`You have declined the order, ${userName}. Please come back again if you want to order another time!`) } - - - - - - - - - - -// // Start here - -// // Step 1 - Welcome and introduction -// // Your code goes here - -// alert ( -// `Welcome to Mama Mia Pizzeria. Ready to order? - Click 'OK' to begin.` -// ) -// const name = prompt(`What's your name?`) - -// alert( - -// `Thank you for choosing our restaurant, ${name}! We’re here to make your experience memorable.` -// ) - -// // Step 2 - What type of food -// const mealchoice = prompt( - -// `What would you like to order? Choose the dish number 1, 2 or 3 according to below: - -// 1. Pizza -// 2. Pasta -// 3. Salad -// ` -// ) - -// if (mealchoice === "1") { - -// alert( - -// `Thank you ${name}, you have chosen no 1, Pizza` - -// ) - -// // Step 3 - Subtype choice for Pizza -// const pizzatype = prompt( - -// `What kind of Pizza would you like? Choose between no 1, 2 or 3 according to below: - -// 1. Capricciosa -// 2. Hawaii -// 3. Kebab pizza -// ` -// ) - -// if (pizzatype === "1") { - -// alert( - -// `Thank you ${name}, you have chosen no 1, Capricciosa. Love your choice!` - -// ) -// } else if (pizzatype === "2") { - -// alert( - -// `Thank you ${name}, you have chosen no 2, Hawaii. Aloha!` -// ) -// } else if (pizzatype === "3") { - -// alert( - -// `Thank you ${name}, you have chosen no 3, Kebab pizza. Great choice!` - -// ) -// } else { - -// alert( - -// `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` -// ) -// } - -// } else if (mealchoice === "2") { -// alert( - -// `Thank you ${name}, you have chosen no 2, Pasta` - -// ) - -// // Step 3 - Subtype choice for Pasta -// const pastatype = prompt( - -// `What kind of pasta would you like? Choose between no 1, 2 or 3 according to below: - -// 1. Bolognese -// 2. Carbonara -// 3. Lasagna -// ` -// ) - -// if (pastatype === "1") { -// alert( - -// `Thank you ${name}, you have chosen no 1, Bolognese. Great choice!` -// ) -// } else if (pastatype === "2") { - -// alert( - -// `Thank you ${name}, you have chosen no 2, Carbonara. Splendido!` -// ) -// } else if (pastatype === "3") { -// alert( - -// `Thank you ${name}, you have chosen no 3, Lasagna. Delicious choice!` -// ) -// } else { - -// alert( - -// `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` -// ) -// } - -// } else if (mealchoice === "3") { - -// alert( - -// `Thank you ${name}, you have chosen no 3, Salad` -// ) - -// // Step 3 - Subtype choice for Salad -// const saladtype = prompt( - -// ` What kind of salad would you like? Choose between no 1, 2 or 3 according to below: - -// 1. Caesar salad -// 2. Greek salad -// 3. Ham & cheese salad -// ` -// ) - -// if (saladtype === "1") { - -// alert( - -// `Thank you ${name}, you have chosen no 1, Caesar salad. Fresh choice!` - -// ) -// } else if (saladtype === "2") { - -// alert( - -// `Thank you ${name}, you have chosen no 2, Greek salad. Healthy choice!` -// ) -// } else if (saladtype === "3") { -// alert( - -// `Thank you ${name}, you have chosen no 3, Ham & cheese salad. Great choice!` - -// ) -// } else { - -// alert( - -// `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.` - -// ) -// } - -// } else { -// alert( - -// `I'm sorry ${name}, that is not a valid option. Please choose number 1, 2 or 3.`) -// } - -// // Step 4 - Age -// // Your code goes here -// const age = prompt( -// `Is this order for an adult or child? Please choose corresponding number below. - -// 1. Adult -// 2. Child -// ` -// ) - -// if (age === "1") { - -// alert( - -// `Thank you ${name}, you have ordered an adult portion.` - -// ) - -// } else if (age === "2") { - -// alert( - -// `Thank you ${name}, you have ordered a child portion.` -// ) - -// } diff --git a/code/style.css b/code/style.css index 3baaccf1..dae6842c 100644 --- a/code/style.css +++ b/code/style.css @@ -19,4 +19,5 @@ body { p { font-size: 1.5em; -} \ No newline at end of file +} + From 9a32629f66775da03166db252d8817f103734cb5 Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Fri, 6 Sep 2024 15:28:46 +0200 Subject: [PATCH 06/15] cleaned up the code a bit and added an emoij to the welcome alert --- code/script.js | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/code/script.js b/code/script.js index aca26559..d15452e1 100644 --- a/code/script.js +++ b/code/script.js @@ -3,7 +3,7 @@ // A while loop is a control flow structure in programming that repeatedly executes a block of code as long as a given condition evaluates to true. The condition is checked before each iteration of the loop, and if the condition is false, the loop terminates. -alert(`Welcome to Mama Mia Pizzeria. Ready to order? - Click 'OK' to begin.`) +alert(`Welcome to Mama Mia Pizzeria 🍕 Ready to order? - Click 'OK' to begin.`) let userName = prompt(`What's your name?`) @@ -42,7 +42,7 @@ if (mealchoice === "1") { mealType = "Pizza" alert(`Thank you ${userName}, you have chosen no 1, Pizza`) - // Step 3 - Subtype choice for Pizza. // Added while loops to check if the user's input is not one of the valid options by using === (equals) + // Step 3 - Subtype choice for Pizza. // Added while loops to check if the user's input is not one of the valid options by using === (strict equality operator) let pizzatype = '' while (!(pizzatype === "1" || pizzatype === "2" || pizzatype === "3")) { @@ -60,26 +60,26 @@ if (mealchoice === "1") { subType = "Capricciosa" alert(`You have chosen no 1, Capricciosa. Love your choice!`) - + } else if (pizzatype === "2") { subType = "Hawaii" - alert(`You have chosen no 2, Hawaii. Aloha!`) } else if (pizzatype === "3") { - subType = "Kebab pizza" alert(`You have chosen no 3, Kebab pizza. Great choice!`) + } else { alert(`I'm sorry ${userName}, that is not a valid option. Please choose number 1, 2 or 3.`) } } + } else if (mealchoice === "2") { mealType = "Pasta" alert(`Thank you ${userName}, you have chosen no 2, Pasta`) - // Step 3 - Subtype choice for Pasta. // Added while loops to check if the user's input is not one of the valid options by using === (equals) +// Step 3 - Subtype choice for Pasta. // Added while loops to check if the user's input is not one of the valid options by using === (equals) let pastatype = "" @@ -97,17 +97,13 @@ if (mealchoice === "1") { if (pastatype === "1") { subType = 'Bolognese' - alert(`You have chosen no 1, Bolognese. Great choice!`) } else if (pastatype === "2") { subType = 'Carbonara' - alert(`You have chosen no 2, Carbonara. Splendido!`) - } else if (pastatype === "3") { subType = 'Lasagna' - alert(`You have chosen no 3, Lasagna. Delicious choice!`) } else { @@ -139,17 +135,12 @@ if (mealchoice === "1") { subType = "Caesar" alert (`You have chosen no 1, Caesar salad. Fresh choice!`) - } else if (saladtype === "2") { - subType = "Greek" alert (`You have chosen no 2, Greek salad. Healthy choice!`) - } else if (saladtype === "3") { subType = "Ham & cheese" - alert (`You have chosen no 3, Ham & cheese salad. Great choice!`) - } else { alert (`I'm sorry ${userName}, that is not a valid option. Please choose number 1, 2 or 3.`) } @@ -174,28 +165,22 @@ while (!(age === "1" || age === "2")) { portionSize = 'adult' alert(`You have chosen an adult portion.`) - } else if (age === "2") { - portionSize = 'child' alert(`You have chosen a child portion.`) - } else { - alert (`I'm sorry ${userName}, that is not a valid option. Please choose number 1 or 2.`) } } // Step 5 - Order confirmation I used confirmOrder.toLowercase to make sure that the user input is not case sensitive. In other words, they can write YES, yes or No, no and it will be valid. -let confirmOrder = prompt (`Do you confirm the order of ${portionSize} portion, ${subType} ${mealType}? Yes or No`) +let confirmOrder = prompt (`Do you confirm the order of ${portionSize} portion, ${subType} ${mealType}? Confirm by writing Yes or No.`) if (confirmOrder.toLowerCase() === "yes") { - - alert(`Thank you for your order, ${userName}! We will start preparing your meal now and we hope you will enjoy the food!`) + alert(`Thank you for your order, ${userName}! We will start preparing your meal and we hope you will enjoy the food!`) } else { - alert(`You have declined the order, ${userName}. Please come back again if you want to order another time!`) } From bfafc1de0b2d7524452db0d1c77ec99590e8a840 Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Fri, 6 Sep 2024 16:10:35 +0200 Subject: [PATCH 07/15] updated readme --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b4f381c4..da0cedc8 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ # Project Name -The project this week, and the first project in sprint 2, our task was to produce a Pizzeria bot. That is a make up-order +The project this week, and the first project in sprint 2, our task was to produce a Pizzeria bot, virtual online Pizzeria with the basic javascript that we studied during this week, using alerts and prompts. ## The problem -I looked at Damiens video and used his example with the "alarm clock" as a basis. I had problems getting each step to work when I first tried using const instead of let and to move on to the next prompt or alert when making an incorrect input, such as choosing nr 4 instead of 1, 2, 3 which are the available options. Then I googled and asked chat gpt and got the response to use while loops. I tried that with some google help and Matildas instructions on the Thursday session and it worked out well. +I looked at Damiens video and used his example with the "alarm clock" as a basis. I had problems getting each step to work when I first tried using const instead of let and to move on to the next prompt or alert when making an incorrect input, such as choosing nr 4 instead of 1, 2, 3 which are the available options. + +Then I googled and asked chat gpt and got the response to use while loops. I tried that with some google help and Matildas instructions on the Thursday session and it worked out well. I have used let as variable and while loops to check if the user's input is not one of the valid options by using === strict equality operator. -If Í hade more time I would try to add more prompts and alerts such as more meal options and add a background image or hero, order button and dig deeper into the JS basics and how to write less code but achieve the same. +If Í hade more time I would try to add more prompts and alerts such as more meal options and add a background image or hero, an order button and dig deeper into the JS basics and how to write less code but achieve the same. ## View it live -Have you deployed your project somewhere? Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about +https://mamamia-pizzeria.netlify.app/ \ No newline at end of file From 11f7ba12a64281b92d8303aee9f539c31c4b768a Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Sun, 8 Sep 2024 18:40:26 +0200 Subject: [PATCH 08/15] updated clarification text to the js code --- code/script.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/script.js b/code/script.js index d15452e1..94ad6602 100644 --- a/code/script.js +++ b/code/script.js @@ -39,7 +39,7 @@ let mealType = '' let subType = '' if (mealchoice === "1") { - mealType = "Pizza" + mealType = "pizza" alert(`Thank you ${userName}, you have chosen no 1, Pizza`) // Step 3 - Subtype choice for Pizza. // Added while loops to check if the user's input is not one of the valid options by using === (strict equality operator) @@ -52,7 +52,7 @@ if (mealchoice === "1") { 1. Capricciosa 2. Hawaii - 3. Kebab pizza + 3. Kebab ` ) @@ -65,7 +65,7 @@ if (mealchoice === "1") { subType = "Hawaii" alert(`You have chosen no 2, Hawaii. Aloha!`) } else if (pizzatype === "3") { - subType = "Kebab pizza" + subType = "Kebab" alert(`You have chosen no 3, Kebab pizza. Great choice!`) } else { @@ -76,7 +76,7 @@ if (mealchoice === "1") { } else if (mealchoice === "2") { - mealType = "Pasta" + mealType = "pasta" alert(`Thank you ${userName}, you have chosen no 2, Pasta`) // Step 3 - Subtype choice for Pasta. // Added while loops to check if the user's input is not one of the valid options by using === (equals) @@ -112,7 +112,7 @@ if (mealchoice === "1") { } } else if (mealchoice === "3") { - mealType = "Salad" + mealType = "salad" alert(`Thank you ${userName}, you have chosen no 3, Salad`) From c6643e942a56632d3fdbf0e91f33584d7f429de8 Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Sun, 8 Sep 2024 18:42:22 +0200 Subject: [PATCH 09/15] updated subtype name --- code/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/script.js b/code/script.js index 94ad6602..12ff66ca 100644 --- a/code/script.js +++ b/code/script.js @@ -15,7 +15,7 @@ alert(`Thank you for choosing our restaurant, ${userName.toUpperCase()}! We're h // Step 2 - What type of food -// Added while loops to check if the user's input is not one of the valid options by using === ( strict equality operator) +// Added while loops to check if the user's input is not one of the valid options by using === ( strict equality operator) and with the loop keep prompting the user until he/she provide the valid input (one of the alternative meal choices or subtypes) let mealchoice = '' while (!(mealchoice === "1" || mealchoice === "2" || mealchoice === "3")) { From 6412c19507ef7ec1c5c6e9dc41b5b5936c65c0c7 Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Sun, 8 Sep 2024 20:58:52 +0200 Subject: [PATCH 10/15] updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da0cedc8..814fc992 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ I looked at Damiens video and used his example with the "alarm clock" as a basis Then I googled and asked chat gpt and got the response to use while loops. I tried that with some google help and Matildas instructions on the Thursday session and it worked out well. -I have used let as variable and while loops to check if the user's input is not one of the valid options by using === strict equality operator. +I have used let as variable and assigned empty strings as initial values to the variable. I have used while loops to check if the user's input is not one of the valid options by using === strict equality operator. If Í hade more time I would try to add more prompts and alerts such as more meal options and add a background image or hero, an order button and dig deeper into the JS basics and how to write less code but achieve the same. From 5e7e05a6b0f4dfa8a44344a6c80006950aa0c77a Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Sun, 8 Sep 2024 21:04:46 +0200 Subject: [PATCH 11/15] cleaned up js a little --- code/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/script.js b/code/script.js index 12ff66ca..a374d636 100644 --- a/code/script.js +++ b/code/script.js @@ -81,7 +81,7 @@ if (mealchoice === "1") { // Step 3 - Subtype choice for Pasta. // Added while loops to check if the user's input is not one of the valid options by using === (equals) - let pastatype = "" + let pastatype = '' while (!(pastatype === "1" || pastatype === "2" || pastatype === "3")) { From b66e95b26a8d0093258c3d37e37d861435dda5bb Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Sun, 8 Sep 2024 22:08:15 +0200 Subject: [PATCH 12/15] updated readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 814fc992..51475897 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ The project this week, and the first project in sprint 2, our task was to produc I looked at Damiens video and used his example with the "alarm clock" as a basis. I had problems getting each step to work when I first tried using const instead of let and to move on to the next prompt or alert when making an incorrect input, such as choosing nr 4 instead of 1, 2, 3 which are the available options. -Then I googled and asked chat gpt and got the response to use while loops. I tried that with some google help and Matildas instructions on the Thursday session and it worked out well. - -I have used let as variable and assigned empty strings as initial values to the variable. I have used while loops to check if the user's input is not one of the valid options by using === strict equality operator. +Then I googled and got the response to use while loops. I tried that with some google help and Matildas instructions on the Thursday session and it worked out well. +I have used let as variable and assigned empty strings as initial values to the variable. I have used while loops to check if the user's input is not one of the valid options by using === strict equality operator. I struggled with keeping my head straight with all the different meal choices, subtypes, portion sizes etc. + If Í hade more time I would try to add more prompts and alerts such as more meal options and add a background image or hero, an order button and dig deeper into the JS basics and how to write less code but achieve the same. ## View it live From 094ba21c6406e37451833c6109e1ede5a49cbc3c Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Mon, 9 Sep 2024 09:53:21 +0200 Subject: [PATCH 13/15] small fix to code --- code/script.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/code/script.js b/code/script.js index a374d636..d7534fe5 100644 --- a/code/script.js +++ b/code/script.js @@ -17,7 +17,7 @@ alert(`Thank you for choosing our restaurant, ${userName.toUpperCase()}! We're h // Added while loops to check if the user's input is not one of the valid options by using === ( strict equality operator) and with the loop keep prompting the user until he/she provide the valid input (one of the alternative meal choices or subtypes) -let mealchoice = '' +let mealchoice = "" while (!(mealchoice === "1" || mealchoice === "2" || mealchoice === "3")) { mealchoice = prompt( @@ -35,15 +35,15 @@ while (!(mealchoice === "1" || mealchoice === "2" || mealchoice === "3")) { } } -let mealType = '' -let subType = '' +let mealType = "" +let subType = "" if (mealchoice === "1") { mealType = "pizza" alert(`Thank you ${userName}, you have chosen no 1, Pizza`) // Step 3 - Subtype choice for Pizza. // Added while loops to check if the user's input is not one of the valid options by using === (strict equality operator) - let pizzatype = '' + let pizzatype = "" while (!(pizzatype === "1" || pizzatype === "2" || pizzatype === "3")) { pizzatype = prompt( @@ -81,7 +81,7 @@ if (mealchoice === "1") { // Step 3 - Subtype choice for Pasta. // Added while loops to check if the user's input is not one of the valid options by using === (equals) - let pastatype = '' + let pastatype = "" while (!(pastatype === "1" || pastatype === "2" || pastatype === "3")) { @@ -117,7 +117,7 @@ if (mealchoice === "1") { alert(`Thank you ${userName}, you have chosen no 3, Salad`) // Step 3 - Subtype choice for Salad - let saladtype = '' + let saladtype = "" while (!(saladtype === "1" || saladtype === "2" || saladtype === "3")) { @@ -148,8 +148,8 @@ if (mealchoice === "1") { } // Step 4 - Portion size // Added while loops to check if the user's input is not one of the valid options by using === (equals) -let age = '' -let portionSize = '' +let age = "" +let portionSize = "" while (!(age === "1" || age === "2")) { age = prompt( From f0aaa947c7cce96a9dd78052659f5389447d7b1e Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Mon, 9 Sep 2024 09:55:10 +0200 Subject: [PATCH 14/15] small clean up code --- code/script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/script.js b/code/script.js index d7534fe5..a7738739 100644 --- a/code/script.js +++ b/code/script.js @@ -176,7 +176,8 @@ while (!(age === "1" || age === "2")) { // Step 5 - Order confirmation I used confirmOrder.toLowercase to make sure that the user input is not case sensitive. In other words, they can write YES, yes or No, no and it will be valid. -let confirmOrder = prompt (`Do you confirm the order of ${portionSize} portion, ${subType} ${mealType}? Confirm by writing Yes or No.`) +let confirmOrder = prompt (`Do you confirm the order of ${portionSize} portion, + ${subType} ${mealType}? Confirm by writing Yes or No.`) if (confirmOrder.toLowerCase() === "yes") { alert(`Thank you for your order, ${userName}! We will start preparing your meal and we hope you will enjoy the food!`) From 11bd1063161c90a0a6f57a4f1c68bf7438d736c0 Mon Sep 17 00:00:00 2001 From: Anna Hansen Date: Tue, 10 Sep 2024 10:40:27 +0200 Subject: [PATCH 15/15] updated names of variables for clarity and use of camelCase --- code/script.js | 62 ++++++++++++++++++++-------------------- pull_request_template.md | 2 +- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/code/script.js b/code/script.js index a7738739..b6a7079e 100644 --- a/code/script.js +++ b/code/script.js @@ -1,4 +1,4 @@ -// I have used while loops and let before const, so the variable can change in the loop. I have also assigned empty strings. +// I have used while loops and let before const, so the variable can change in the loop. I have also assigned empty strings. The empty string is useful since it doesn’t imply any pre-selection or default choice, which means the code will rely entirely on user input, in this case the different meal choices. // A while loop is a control flow structure in programming that repeatedly executes a block of code as long as a given condition evaluates to true. The condition is checked before each iteration of the loop, and if the condition is false, the loop terminates. @@ -17,9 +17,9 @@ alert(`Thank you for choosing our restaurant, ${userName.toUpperCase()}! We're h // Added while loops to check if the user's input is not one of the valid options by using === ( strict equality operator) and with the loop keep prompting the user until he/she provide the valid input (one of the alternative meal choices or subtypes) -let mealchoice = "" -while (!(mealchoice === "1" || mealchoice === "2" || mealchoice === "3")) { - mealchoice = prompt( +let mealChoice = "" +while (!(mealChoice === "1" || mealChoice === "2" || mealChoice === "3")) { + mealChoice = prompt( `What would you like to order? Choose the dish number 1, 2 or 3 according to below: @@ -30,23 +30,23 @@ while (!(mealchoice === "1" || mealchoice === "2" || mealchoice === "3")) { ) // If none of the valid options (!) are chosen the alert below will show) - if (!(mealchoice === "1" || mealchoice === "2" || mealchoice === "3")) { + if (!(mealChoice === "1" || mealChoice === "2" || mealChoice === "3")) { alert(`I'm sorry ${userName}, that is not a valid option. Please choose number 1, 2 or 3.`) } } -let mealType = "" +let selectedMeal = "" let subType = "" -if (mealchoice === "1") { - mealType = "pizza" +if (mealChoice === "1") { + selectedMeal = "pizza" alert(`Thank you ${userName}, you have chosen no 1, Pizza`) // Step 3 - Subtype choice for Pizza. // Added while loops to check if the user's input is not one of the valid options by using === (strict equality operator) - let pizzatype = "" + let pizzaType = "" - while (!(pizzatype === "1" || pizzatype === "2" || pizzatype === "3")) { - pizzatype = prompt( + while (!(pizzaType === "1" || pizzaType === "2" || pizzaType === "3")) { + pizzaType = prompt( `What kind of Pizza would you like? Choose between no 1, 2 or 3 according to below: @@ -56,15 +56,15 @@ if (mealchoice === "1") { ` ) - if (pizzatype === "1") { + if (pizzaType === "1") { subType = "Capricciosa" alert(`You have chosen no 1, Capricciosa. Love your choice!`) - } else if (pizzatype === "2") { + } else if (pizzaType === "2") { subType = "Hawaii" alert(`You have chosen no 2, Hawaii. Aloha!`) - } else if (pizzatype === "3") { + } else if (pizzaType === "3") { subType = "Kebab" alert(`You have chosen no 3, Kebab pizza. Great choice!`) @@ -75,17 +75,17 @@ if (mealchoice === "1") { } -} else if (mealchoice === "2") { - mealType = "pasta" +} else if (mealChoice === "2") { + selectedMeal = "pasta" alert(`Thank you ${userName}, you have chosen no 2, Pasta`) // Step 3 - Subtype choice for Pasta. // Added while loops to check if the user's input is not one of the valid options by using === (equals) - let pastatype = "" + let pastaType = "" - while (!(pastatype === "1" || pastatype === "2" || pastatype === "3")) { + while (!(pastaType === "1" || pastaType === "2" || pastaType === "3")) { - pastatype = prompt( + pastaType = prompt( `What kind of pasta would you like? Choose between no 1, 2 or 3 according to below: 1. Bolognese @@ -94,15 +94,15 @@ if (mealchoice === "1") { ` ) - if (pastatype === "1") + if (pastaType === "1") { subType = 'Bolognese' alert(`You have chosen no 1, Bolognese. Great choice!`) - } else if (pastatype === "2") { + } else if (pastaType === "2") { subType = 'Carbonara' alert(`You have chosen no 2, Carbonara. Splendido!`) - } else if (pastatype === "3") { + } else if (pastaType === "3") { subType = 'Lasagna' alert(`You have chosen no 3, Lasagna. Delicious choice!`) @@ -111,17 +111,17 @@ if (mealchoice === "1") { } } -} else if (mealchoice === "3") { - mealType = "salad" +} else if (mealChoice === "3") { + selectedMeal = "salad" alert(`Thank you ${userName}, you have chosen no 3, Salad`) // Step 3 - Subtype choice for Salad - let saladtype = "" + let saladType = "" - while (!(saladtype === "1" || saladtype === "2" || saladtype === "3")) { + while (!(saladType === "1" || saladType === "2" || saladType === "3")) { - saladtype = prompt( + saladType = prompt( ` What kind of salad would you like? Choose between no 1, 2 or 3 according to below: @@ -131,14 +131,14 @@ if (mealchoice === "1") { ` ) - if (saladtype === "1") { + if (saladType === "1") { subType = "Caesar" alert (`You have chosen no 1, Caesar salad. Fresh choice!`) - } else if (saladtype === "2") { + } else if (saladType === "2") { subType = "Greek" alert (`You have chosen no 2, Greek salad. Healthy choice!`) - } else if (saladtype === "3") { + } else if (saladType === "3") { subType = "Ham & cheese" alert (`You have chosen no 3, Ham & cheese salad. Great choice!`) } else { @@ -177,7 +177,7 @@ while (!(age === "1" || age === "2")) { // Step 5 - Order confirmation I used confirmOrder.toLowercase to make sure that the user input is not case sensitive. In other words, they can write YES, yes or No, no and it will be valid. let confirmOrder = prompt (`Do you confirm the order of ${portionSize} portion, - ${subType} ${mealType}? Confirm by writing Yes or No.`) + ${subType} ${selectedMeal}? Confirm by writing Yes or No.`) if (confirmOrder.toLowerCase() === "yes") { alert(`Thank you for your order, ${userName}! We will start preparing your meal and we hope you will enjoy the food!`) diff --git a/pull_request_template.md b/pull_request_template.md index e239e19f..46dbda47 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -1,6 +1,6 @@ ## Netlify link Add your Netlify link here like this (update with the correct one): -https://my-netlify-link.netlify.app +https://mamamia-pizzeria.netlify.app/ PS. Don't forget to add it in your readme as well.