Skip to content
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

Gabriella Iofe: Giovannis Pizzeria. pizza-project #157

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really enjoyed reading about your process in the README as I found it to be quite interesting and relatable, but there are some typos which made it a little distracting.

## 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/
2 changes: 1 addition & 1 deletion code/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Javascript Pizzeria</title>
<title>Giovannis Pizzeria</title>
<link rel="stylesheet" href="./style.css" />
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
Expand Down
106 changes: 102 additions & 4 deletions code/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,116 @@

// 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 A prompt asking for the clients name
const name = prompt('What is your name?')
// Step 1c An alert confirmin the clients name
alert(`Ciao ${name.toUpperCase()}, Let's get started with your order!`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice touch to have my name in all caps 😀

// Step 2 - Food choice
// Your code goes here

// 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`)


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')
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for fun, I tried entering an invalid choice, and it had me go ahead and move on to the next question anyway. There are a couple ways to make this more logical: For example, I used a while loop to force the user to enter a valid number or else I would continuously prompt the user to enter 1 2 or 3. Another option is to use switch statements where the default case (anything other than options 1, 2, or 3) can alert an invalid choice and you can use location.reload() which should reload the page to start over.


// 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')
}
}

alert(`You have chosen a ${subChoice}`)

// Step 4 - Age
// Your code goes here
// Prompt where client is asked about their age to determine meal size
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'`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't do anything when I entered my age (but weirdly, it worked when I tried with the number 2, then I got a child sized confirmation). I think it may be the same issue I had when I did my project, which is I had to cast the age variable to be a number in order to do things with the comparison operator, and then it worked for me. I think whenever you declare a variable, it defaults to be a string. So maybe try after you state let age = prompt ... then add this:
age = Number(age)
and that should convert the string type to a number type and then the following if statements should work.


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
} else if (age <= 12) {
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 65kr
}

// Step 5 - Order confirmation
// Your code goes here
alert(`Thank you ${name.toUpperCase()}, you have ordered our ${age} ${subChoice}. Coming right up! `)
5 changes: 1 addition & 4 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
## Netlify link
Add your Netlify link here like this (update with the correct one):

https://my-netlify-link.netlify.app

PS. Don't forget to add it in your readme as well.
https://pizzeriagivovanni.netlify.app/