-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinal_project.js
More file actions
41 lines (37 loc) · 845 Bytes
/
final_project.js
File metadata and controls
41 lines (37 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
functiongreet(name);{
console.log("high" +name+age+ "welcome to Amons minishop");
}
function showmenu(){
console.log("\nhere is our menu");
console.log("1.bread ,50");
console.log("2.milk ,40");
console.log("3.sugar ,100");
}
function price(choice){
if (choice==="1"){
return 50;
}
if (choice==="2"){
return 40;
}
if (choice==="3"){
return 100;
}
}
else {
return 0;
}
let name=prompt("what is your name?");
let age=parseint(prompt("how old are you"));
let choice=prompt("pick a number(1-4):");
let price=getprice(choice);
if (price===0){
console.log("we dont have that on our menu");
}
else{
if (age<10){
console.log("you qualify for 10 discount");
}
console.log("the final price is :");
}
console.log("thank you,come again.");