From 8cb93813acecb6ef452a3eda715f7eef7da78aee Mon Sep 17 00:00:00 2001 From: gabster94 Date: Sun, 8 Sep 2024 20:18:01 +0200 Subject: [PATCH 1/6] Created two alerts, one to welcome and one to comfirn the clients name. I also stored the input in a variable --- code/script.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/script.js b/code/script.js index 34ca0f34..86f60019 100644 --- a/code/script.js +++ b/code/script.js @@ -2,12 +2,20 @@ // Step 1 - Welcome and introduction // Your code goes here +// Step 1a alert( `Welcome to our Javascript Pizzeria. Ready to Start? - Click 'OK' to begin.` ) +// Step 1b +const name = prompt('What is your name?') +// Step 1c +alert(`Nice to meet you ${name.toUpperCase()} let's pick your dinner`) // Step 2 - Food choice // Your code goes here +// Step 2a + +// Step 2b // Step 3 - Subtype choice // Your code goes here From 58b670c6cb465baffb3fc5f2136afb6e77a278cb Mon Sep 17 00:00:00 2001 From: gabster94 Date: Wed, 11 Sep 2024 14:31:00 +0200 Subject: [PATCH 2/6] created a mealSelection (step 2) and subChoices (step 3) --- code/script.js | 85 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/code/script.js b/code/script.js index 86f60019..a6d32bf3 100644 --- a/code/script.js +++ b/code/script.js @@ -6,20 +6,99 @@ alert( `Welcome to our Javascript Pizzeria. Ready to Start? - Click 'OK' to begin.` ) -// Step 1b +// Step 1b A prompt asking for the clients name const name = prompt('What is your name?') -// Step 1c -alert(`Nice to meet you ${name.toUpperCase()} let's pick your dinner`) +// Step 1c An alert confirmin the clients name +alert(`Ciao ${name.toUpperCase()}, Let's get started with your order!`) // Step 2 - Food choice // Your code goes here // Step 2a +// Prompt with a meal selection + +const mealSelection = prompt(`Please, select what dish you would have us cook for you: + + Press: 1 - for Pizza + Press: 2 - for Pasta + Press: 3 - for Salad`) // Step 2b +if (mealSelection === '1') { + alert('You have selected a pizza!') +} else if (mealSelection === '2') { + alert('You have selected pasta!') +} else if (mealSelection === '3') { + alert('You have selected a salad!') +} else { + alert('Invalid choice. Please use a number between 1 and 3') +} // Step 3 - Subtype choice // Your code goes here +let subChoice = '' + +if (mealSelection === '1') { + //if the client selects Pizza to order + subChoice = prompt( +`Choose your preffered pizza topping. + + Press: 1 - for Margarita + Press: 2 - for Pepperoni + Press: 3 - for Hawaii`) + + + if (subChoice === '1') { + subChoice = 'Margarita' + } else if (subChoice === '2') { + subChoice = 'Pepperoni' + } else if (subChoice === '3') { + subChoice = 'Hawaii' + } else { + alert('Invalid choice. Please use a number between 1 and 3') + } + + + + } else if (mealSelection === '2') { + //if the client selects Pasta to order + subChoice = prompt(`Choose your preffered pasta dish. + + Press: 1 - for Bolognese + Press: 2 - for King Shrimp + Press: 3 - for Carbonara`) + + if (subChoice === '1') { + subChoice = 'Bolognese' + } else if (subChoice === '2') { + subChoice = 'King Shrimp' + } else if (subChoice === '3') { + subChoice = 'Carbonara' + } else { + alert('Invalid choice. Please use a number between 1 and 3') + } + + + + } else if (mealSelection === '3') { + //if the client selects Pasta to order + subChoice = prompt(`Choose your preffered refreshing salad. + + Press: 1 - for Goat Cheese Salad + Press: 2 - for Ceasar Salad + Press: 3 - for Tuna Salad`) + + if (subChoice === '1') { + subChoice = 'Goat Cheese Salad' + } else if (subChoice === '2') { + subChoice = 'Ceasar Salad' + } else if (subChoice === '3') { + subChoice = 'Tuna Salad' + } else { + alert('Invalid choice. Please use a number between 1 and 3') + } + } + // Step 4 - Age // Your code goes here From aae0ad78d7b29bf52acc85db13c499e89a5645b0 Mon Sep 17 00:00:00 2001 From: gabster94 Date: Wed, 11 Sep 2024 16:25:14 +0200 Subject: [PATCH 3/6] I have added a prompt where I ask about the clients age and a block where the meal size is determined. --- code/script.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/code/script.js b/code/script.js index a6d32bf3..419a2b69 100644 --- a/code/script.js +++ b/code/script.js @@ -79,7 +79,7 @@ if (mealSelection === '1') { } - + } else if (mealSelection === '3') { //if the client selects Pasta to order subChoice = prompt(`Choose your preffered refreshing salad. @@ -99,8 +99,22 @@ if (mealSelection === '1') { } } + alert(`You have chosen a ${subChoice}`) + // Step 4 - Age -// Your code goes here + +let age = prompt(`${name}, to ensure you get full by your meal we would like to know your age. Please, type in your age and click 'OK'`) + + +if (age > 12) { + age = 'Adult sized' + alert(`You will be delivered an Adult sized ${subChoice}`) + // If the age is greater than 12 the meal will become adult sized 100kr +} else if (age <= 12) { + age = 'Child sized' + alert(`You will be delivered a Child sized ${subChoice}`) + // If the age is smaller than 12 the meal will become children's sized 50kr +} // Step 5 - Order confirmation // Your code goes here From d2854615e3b22e3b5323ecc98ac660fe20c3b373 Mon Sep 17 00:00:00 2001 From: gabster94 Date: Wed, 11 Sep 2024 16:26:21 +0200 Subject: [PATCH 4/6] forgot to save the previous one, making another push --- code/script.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/script.js b/code/script.js index 419a2b69..a52efb7c 100644 --- a/code/script.js +++ b/code/script.js @@ -102,18 +102,18 @@ if (mealSelection === '1') { alert(`You have chosen a ${subChoice}`) // Step 4 - Age - +// Prompt where client is asked about their age to determine meal size let age = prompt(`${name}, to ensure you get full by your meal we would like to know your age. Please, type in your age and click 'OK'`) if (age > 12) { - age = 'Adult sized' + age = 'Adult sized, 120kr' alert(`You will be delivered an Adult sized ${subChoice}`) - // If the age is greater than 12 the meal will become adult sized 100kr + // If the age is greater than 12 the meal will become adult sized 120kr } else if (age <= 12) { - age = 'Child sized' + age = 'Child sized 65kr' alert(`You will be delivered a Child sized ${subChoice}`) - // If the age is smaller than 12 the meal will become children's sized 50kr + // If the age is smaller than 12 the meal will become children's sized 65kr } // Step 5 - Order confirmation From d21f8e1b41045469b16ede3c6c2e0822c904ffcc Mon Sep 17 00:00:00 2001 From: gabster94 Date: Wed, 11 Sep 2024 17:02:50 +0200 Subject: [PATCH 5/6] final step, created an alert with the order confirmation --- code/script.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/code/script.js b/code/script.js index a52efb7c..9e177942 100644 --- a/code/script.js +++ b/code/script.js @@ -12,17 +12,15 @@ const name = prompt('What is your name?') alert(`Ciao ${name.toUpperCase()}, Let's get started with your order!`) // Step 2 - Food choice -// Your code goes here -// Step 2a -// Prompt with a meal selection +// Prompt with a meal selection const mealSelection = prompt(`Please, select what dish you would have us cook for you: Press: 1 - for Pizza Press: 2 - for Pasta Press: 3 - for Salad`) -// Step 2b + if (mealSelection === '1') { alert('You have selected a pizza!') } else if (mealSelection === '2') { @@ -34,7 +32,6 @@ if (mealSelection === '1') { } // Step 3 - Subtype choice -// Your code goes here let subChoice = '' @@ -103,10 +100,10 @@ if (mealSelection === '1') { // Step 4 - Age // Prompt where client is asked about their age to determine meal size -let age = prompt(`${name}, to ensure you get full by your meal we would like to know your age. Please, type in your age and click 'OK'`) +let age = prompt(`${name.toUpperCase()}, to ensure you get full by your meal we would like to know your age. Please, type in your age and click 'OK'`) -if (age > 12) { +if (age > 12) {g age = 'Adult sized, 120kr' alert(`You will be delivered an Adult sized ${subChoice}`) // If the age is greater than 12 the meal will become adult sized 120kr @@ -117,4 +114,4 @@ if (age > 12) { } // Step 5 - Order confirmation -// Your code goes here +alert(`Thank you ${name.toUpperCase()}, you have ordered our ${age} ${subChoice}. Coming right up! `) \ No newline at end of file From 2dfd53ed0e20fc06c4e76430fb25e2f24745ff99 Mon Sep 17 00:00:00 2001 From: gabster94 Date: Wed, 11 Sep 2024 18:47:33 +0200 Subject: [PATCH 6/6] Added my own text to the read me file and changed the name of the pizzeria in the html --- README.md | 10 +++++++--- code/index.html | 2 +- pull_request_template.md | 5 +---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 33c7e601..03e2ebd9 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,15 @@ # 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 Pizzeria-bot assignment is an introduction to JavaScrips and meant to challenge and teach me how to use alerts (pop-up windows), write clean JS code, the use of variables and the use of data types - among many other new things regarding JS. The Assignment was divided into 5 steps with some sub-steps. ## 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? +After looking through all the provided material by Technigo I started by writing down each step and the requirement for each step on a post-it note each, to then lay them out on a row. This way I could focus on each post-it (step) without getting overwhelmed or being distracted by the other steps. When done, I flipped the post-it note and went on with the next post-it (step). + +Step 1 and 2 felt pretty straight forward and simple, while step 3 got me into a position of thiking and scrathicng my head. After looking though different options of solving the problem I started trying out. I tried different approaches in CodePen until I was satisfied and copy/pasted it into VScode. The hardest part was figuring out how I initally wanted it to look, and how to make the code work, but when I finally uderstood it, the rest felt simple. + +If I would have more time on my hands, I ould have worked more woth understanding everything, there are still many things that I don't understand. I wouls also make the code loop when incorrect answers were given, until the right one is entered. ## 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://pizzeriagivovanni.netlify.app/ diff --git a/code/index.html b/code/index.html index f7844d6b..d6624a29 100644 --- a/code/index.html +++ b/code/index.html @@ -3,7 +3,7 @@ - Javascript Pizzeria + Giovannis Pizzeria