11// Start here
2-
2+ let subChoice
33// Step 1 - Welcome and introduction
44// Your code goes here
55alert (
66 `Welcome to our Javascript Pizzeria. Ready to Start? - Click 'OK' to begin.`
77)
88
9+ let person = prompt ( "Please enter your name:" , "Harry Potter" ) ;
910// Step 2 - Food choice
1011// Your code goes here
12+ alert ( `Hello ${ person } ! What would you like to order?` )
13+ // later fix invalied, for example other numbers.
14+ let foodChoice = prompt ( `Select the number of the food you would like to eat. 1.Pizza 2.Pasta 3.Salad` , "" ) ;
1115
1216// Step 3 - Subtype choice
1317// Your code goes here
18+ if ( foodChoice === "1" ) { foodChoice = "Pizza"
19+ alert ( "You have chosen Pizza!" )
20+ subChoice = prompt ( `What kind of Pizza would you like to eat? 1.Margherita 2.Pepperoni 3.Hawaiian` , "" )
21+ if ( subChoice === "1" ) { subChoice = "Margherita"
22+ alert ( "You have chosen Margherita!" )
23+ } else if ( subChoice === "2" ) { subChoice = "Pepperoni"
24+ alert ( "You have chosen Pepperoni!" )
25+ } else { subChoice = "Hawaiian"
26+ alert ( "You have chosen Hawaiian!" )
27+ }
28+ } else if ( foodChoice === "2" ) { foodChoice = "Pasta"
29+ alert ( "You have chosen Pasta!" )
30+ subChoice = prompt ( `What kind of pasta would you like to eat? 1.Spaghetti Bolognaise 2.Lasagne 3.Fettuccine Alfredo` , "" )
31+ if ( subChoice === "1" ) { subChoice = "Spaghetti Bolognaise"
32+ alert ( "You have chosen Spaghetti Bolognaise!" )
33+ } else if ( subChoice === "2" ) { subChoice = "Lasagne"
34+ alert ( "You have chosen Lasagne!" )
35+ } else { subChoice = "Fettuccine Alfredo"
36+ alert ( "You have chosen Fettuccine Alfredo!" )
37+ }
38+ } else { foodChoice = "Salad"
39+ alert ( "you have chosen Salad!" )
40+ subChoice = prompt ( `What kind of Sallad would you like to eat? 1.Caesar salad 2.Greek salad 3.Pasta salad` , "" )
41+ if ( subChoice === "1" ) { subChoice = "Caesar salad"
42+ alert ( "You have chosen Caesar salad!" )
43+ } else if ( subChoice === "2" ) { subChoice = "Greek salad"
44+ alert ( "You have chosen Greek salad!" )
45+ } else { subChoice = "Pasta salad"
46+ alert ( "You have chosen Pasta salad!" )
47+ }
48+ } ;
1449
1550// Step 4 - Age
1651// Your code goes here
52+ let age = prompt ( `Is the food for an adult or for a child? Please enter your age` , "" ) ;
53+ if ( parseInt ( age ) <= 15 ) {
54+ alert ( "The food is for a child" )
55+ } else {
56+ alert ( "The food is for an adult" )
57+ } ;
1758
1859// Step 5 - Order confirmation
1960// Your code goes here
61+ let confirmation = confirm ( `Please confirm that your name is ${ person } , that the food you ordered is ${ foodChoice } and ${ subChoice } and that
62+ you are ${ age } years old ` )
63+ if ( confirm ) {
64+ alert ( "Thank you for your order! Your food will arrive soon." )
65+ } else {
66+ alert ( "Sorry, please return in the future." )
67+ } ;
0 commit comments