You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/************************************************ DONT CHANGE THE CODE BELOW ******************************************************/
27
+
functionalert3(){
28
+
alert("All students need to get their student IDs, but it seems like the system is down. Can you help debug the system? Go to the example2.js file and work on checkpoint 2.");
29
+
}
30
+
31
+
functionalerts(studentID){
32
+
if(studentID.length==5){
33
+
alert("Yay! You got the system running!");
34
+
}
35
+
else{
36
+
alert("Hmmm! It seems like Rei hasn't received his ID. Keep debugging!");
* Description: This program is calculating the amount of change given to the customer after buying groceries but there is a bug
3
+
* in the code preventing the code to run as expected. Your task is to run and debug the program using the console to print
4
+
* statements.
5
+
*
6
+
* TODO: The program currently displays NaN in the console as the returned change. You should check and make sure the function
7
+
* is reading the passed parameters.
8
+
*/
9
+
10
+
functioncheckPoint3(){
11
+
alert4();
12
+
13
+
// TODO: Remove the bugs from the code below.
14
+
functionsuperMarket(cash){
15
+
letmilk=4.99;
16
+
letvegetables=15.99;
17
+
letbread=2.99;
18
+
19
+
lettotal=milk+vegetables+bread;
20
+
cash=cash-total;
21
+
22
+
returncash;
23
+
}
24
+
25
+
functionmain(cash){
26
+
letmoneySpent=superMarket(cash);
27
+
returnmoneySpent;
28
+
}
29
+
30
+
lettotalCash=50.00;
31
+
console.log("Total Cash: $"+totalCash);
32
+
console.log("Change Return = $"+main(totalCash));
33
+
34
+
35
+
36
+
// DO NOT CHANGE THE CODE BELOW
37
+
if(main(totalCash)<50){
38
+
alert("Awesome work! You got the system running!");
39
+
}
40
+
}
41
+
42
+
43
+
/************************************************ DONT CHANGE THE CODE BELOW ******************************************************/
44
+
functionalert4(){
45
+
alert("The system at the supermarket doesn't seem to be working. Can you help debug the system to help calculate the total change return to the customer? Go to the example3.js file and work on checkpoint 3.");
0 commit comments