-
Notifications
You must be signed in to change notification settings - Fork 174
Estefanny's PR pizzabot #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6f448e1
10d9fc0
bf49223
a84baf1
f8ea5c3
ae97d5c
dadfaab
3c75068
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,20 @@ | ||
| # 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. | ||
| For this project #4 we focused on basic JavaScript concepts like variables, conditionals, and native methods, Using alert() and prompt() to collect information from our customers | ||
|
|
||
| ## 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? | ||
| This time I was very focus in all the information we got from Disco, and I was focusing in 1 step at the time. I started by trying to understand the logic of each element, such as =, ==, ===, let, const, etc. | ||
|
|
||
| I would say that 90% of the time I was reading and collecting information from W3school and stack overflow, I tried to use chatgpt but sometimes it was giving me a very different way of building the project, I believe with more advance variables and conditionals. | ||
|
|
||
| If I had more time I would like to make it with the options that chatgpt suggested to see if it work better. | ||
|
|
||
| ## 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 | ||
|
|
||
|
|
||
| My site #4 | ||
|
|
||
| https://precious-zabaione-04568c.netlify.app | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,18 +2,110 @@ | |
|
|
||
| // Step 1 - Welcome and introduction | ||
| // Your code goes here | ||
| alert( | ||
| `Welcome to our Javascript Pizzeria. Ready to Start? - Click 'OK' to begin.` | ||
| ) | ||
|
|
||
| alert("Welcome to our Javascript Pizzeria. Ready to Start? - Click 'OK' to begin.") | ||
| let customerName = prompt("Please enter your name", "Your name") | ||
| alert("Hi " + customerName + "! What are you craving today? \nPlease press \"ok\” to continue.") | ||
| const errMsg = "Incorrect number, please enter 1, 2 or 3." | ||
|
|
||
| // Step 2 - Food choice | ||
| // Your code goes here | ||
|
|
||
| let foodChoice = "" | ||
| while (foodChoice == "") { | ||
| let choice = prompt("Please enter a number: \n 1 - Pizza \n 2 - Pasta \n 3 - Salad", "Please type you number of choice here") | ||
| if (choice == 1) { | ||
| foodChoice = "Pizza" | ||
| } else if (choice == 2) { | ||
| foodChoice = "Pasta" | ||
| } else if (choice == 3) { | ||
| foodChoice = "Salad" | ||
| } else { | ||
| alert(errMsg) | ||
| } | ||
| } | ||
|
|
||
| alert("You have selected: " + foodChoice + ". Yummy!") | ||
|
|
||
| // Step 3 - Subtype choice | ||
| // Your code goes here | ||
|
|
||
| let foodType = "" | ||
| while (foodType == "") { | ||
| if (foodChoice == "Pizza") { | ||
| choice = prompt("Please enter a number: \n 1 - Napolitana \n 2 - Margherita \n 3 - Sicilian", "Please type you number of choice here") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be cool if you also included something in the message like, "What type of pizza would you like?" Please enter a number.....🤩 |
||
| if (choice == 1) { | ||
| foodType = "Napolitana" | ||
| } else if (choice == 2) { | ||
| foodType = "Margherita" | ||
| } else if (choice == 3) { | ||
| foodType = "Sicilian" | ||
| } else { | ||
| alert(errMsg) | ||
| } | ||
| } else if (foodChoice == "Pasta") { | ||
| choice = prompt("Please enter a number: \n 1 - Fungui \n 2 - Ragú \n 3 - Carbonara", "Please type you number of choice here") | ||
| if (choice == 1) { | ||
| foodType = "Fungui" | ||
| } else if (choice == 2) { | ||
| foodType = "Ragú" | ||
| } else if (choice == 3) { | ||
| foodType = "Carbonara" | ||
| } else { | ||
| alert(errMsg) | ||
| } | ||
| } else if (foodChoice == "Salad") { | ||
| choice= prompt("Please enter a number: \n 1 - Caesar \n 2 - Greek \n 3 - Caprese", "Please type you number of choice here") | ||
| if (choice == 1) { | ||
| foodType = "Caesar" | ||
| } else if (choice == 2) { | ||
| foodType = "Greek" | ||
| } else if (choice == 3) { | ||
| foodType = "Caprese" | ||
| } else { | ||
| alert(errMsg) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| alert("You have selected: " + foodType + ", great choice!") | ||
|
|
||
| // Step 4 - Age | ||
| // Your code goes here | ||
|
|
||
| let age | ||
| while (isNaN(age) == true || age < 1 || 100 < age) { | ||
| age = prompt("How old are you?", "Please type your age here") | ||
| if (isNaN(age) == true || age < 1 || 100 < age) { | ||
| alert("Please enter a valid age.") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha what if I'm really old 👀 |
||
| } | ||
| } | ||
| let price, size | ||
| if (age > 15) { | ||
| size = "an adult size " | ||
| price = 150 | ||
| } else { | ||
| size = "a kid size " | ||
| price = 75 | ||
| } | ||
|
|
||
| let confirm = "" | ||
| while (confirm == "") { | ||
| choice = prompt("You have chosen " + size + foodType + " " + foodChoice + ". This will cost you " + price + " kr. \nIs this correct? Please enter 1 - for Yes or 2 - for No") | ||
| if (choice == 1) { | ||
| confirm = 1 | ||
| } else if (choice == 2) { | ||
| confirm = 2 | ||
| } else { | ||
| alert("Please enter 1 or 2") | ||
| } | ||
| } | ||
|
|
||
| // Step 5 - Order confirmation | ||
| // Your code goes here | ||
|
|
||
| if (confirm == 1) { | ||
| alert("Thank you for your order! Your delicious meal will be prepared. See you soon " + String.fromCodePoint(0x1F920)) | ||
| } else if (confirm == 2) { | ||
| alert("No problem, come back and order anytime you want!"); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop was really cool! Nice that you get back to the same question again if you type the wrong answer!