-
Notifications
You must be signed in to change notification settings - Fork 175
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
JavaScript pizzeria :) #155
Open
cholpoun
wants to merge
3
commits into
Technigo:main
Choose a base branch
from
cholpoun:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"liveServer.settings.port": 5501 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
# 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. | ||
Built a JavaScript Pizzeria | ||
Mastering vital yet basic JavaScript concepts like variables, conditionals, and native methods. | ||
|
||
## 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 used JavaScript concepts like variables, conditionals, and native methods. | ||
|
||
## 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://66de0156d116e596d11ff09e--coruscating-basbousa-190b83.netlify.app/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,120 @@ | ||
// Start here | ||
|
||
// Step 1 - Welcome and introduction | ||
// Your code goes here | ||
alert( | ||
`Welcome to our Javascript Pizzeria. Ready to Start? - Click 'OK' to begin.` | ||
) | ||
// prompt to ask for the name and store the answer in a variable | ||
const guestName = prompt('Please enter your name') | ||
alert('Hi ' + guestName + '!') | ||
|
||
// Step 2 - Food choice | ||
// Your code goes here | ||
// allow the user to select the type of food they want to order | ||
|
||
const foodChoice = prompt('What type of food would you like to order?\Please enter a number:\ 1 - Pizza 2 - Pasta 3 - Salad'); | ||
|
||
if (foodChoice === '1') { | ||
alert('You have chosen Pizza!') | ||
} else if (foodChoice === '2') { | ||
alert('You have chosen Pasta!') | ||
} | ||
else if (foodChoice === '3') { | ||
alert('You have chosen Salad!') | ||
} | ||
else { | ||
alert('Invalid choice. Please select a number between 1 and 3.') | ||
} | ||
|
||
// Step 3 - Subtype choice | ||
// Your code goes here | ||
|
||
// Pizza subtype | ||
if (foodChoice === '1') { | ||
const pizzaType = prompt('Select a Pizza type! \ Enter a number:\ 1 - Margherita 2 - Pepperoni 3 - Hawaiian') | ||
|
||
if (pizzaType === '1') { | ||
alert('You have chosen Margherita!') | ||
selectedFoodType = 'Margherita' | ||
} else if (pizzaType === '2') { | ||
alert('You have chosen Pepperoni!') | ||
selectedFoodType = Pepperoni | ||
} | ||
else if (pizzaType === '3') { | ||
alert('You have chosen Hawaiian!') | ||
selectedFoodType = 'Hawaiian' | ||
} | ||
else { | ||
alert('Invalid choice. Please select a number between 1 and 3.') | ||
} | ||
} | ||
|
||
|
||
// Pasta subtype | ||
|
||
if (foodChoice === '2') { | ||
const pastaType = prompt('Select a Pasta type! Enter a number: 1 - Spaghetti Carbonara: 2 - Pasta Bolognese 3 - Pasta Alfredo') | ||
|
||
if (pastaType === '1') { | ||
alert('You have chosen Spaghetti Carbonara!') | ||
selectedFoodType = 'Spaghetti Carbonara' | ||
} else if (pastaType === '2') { | ||
alert('You have chosen Pasta Bolognese!') | ||
selectedFoodType = 'Pasta Bolognese' | ||
} | ||
else if (pastaType === '3') { | ||
alert('You have chosen Pasta Alfredo!') | ||
selectedFoodType = 'Pasta Alfredo' | ||
} | ||
else { | ||
alert('Invalid choice. Please select a number between 1 and 3.') | ||
} | ||
} | ||
|
||
//Salad subtype | ||
|
||
if (foodChoice === '3') { | ||
const saladType = prompt('Select a Salad type! Enter a number: 1 - Caesar Salad 2 - Garden Salad 3 - Greek Salad') | ||
|
||
if (saladType === '1') { | ||
alert('You have chosen Caesar Salad!') | ||
selectedFoodType = 'Ceaser Salad' | ||
} else if (saladType === '2') { | ||
alert('You have chosen Garden Salad!') | ||
selectedFoodType = 'Garden Salad' | ||
} | ||
else if (saladType === '3') { | ||
alert('You have chosen Greek Salad!') | ||
selectedFoodType = 'Greek Salad' | ||
} | ||
else { | ||
alert('Invalid choice. Please select a number between 1 and 3.') | ||
} | ||
} | ||
|
||
// Step 4 - Age | ||
// Your code goes here | ||
const guestAge = prompt('Is this food for a child or an adult? Type your age:') | ||
const age = Number(guestAge); | ||
|
||
let finalPrice; | ||
if (guestAge >= '13') { | ||
// Adult | ||
finalPrice = 15; | ||
alert(`One ${selectedFoodType} will be prepared for you. That'll be €15.`); | ||
} | ||
else { | ||
//Child | ||
finalPrice = 10; | ||
alert(`One child sized ${selectedFoodType} will be prepared for you. That'll be €10.`); | ||
} | ||
|
||
// Step 5 - Order confirmation | ||
// Your code goes here | ||
|
||
const confirmation = prompt(`Would you like to confirm your order? Type 'yes' or 'no'.`) | ||
|
||
if (confirmation === 'yes') { | ||
alert('Thank you! Your meal will be prepared shortly. The total cost is ' + finalPrice + '€') | ||
} | ||
else { | ||
alert('We hope to see you again soon!'); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Pepperoni is not defined - should be quotation marks around it
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.
Hi, @JennieDalgren made the requested changes to the JS file.