Please indicate the errors and how to fix them. HINT: #4 has 2 errors /// Debug
ID: 3872932 • Letter: P
Question
Please indicate the errors and how to fix them. HINT: #4 has 2 errors /// Debug Module 3 chapter4 javascript
1-If x = 100 Then
y = 20
z = 40
End If
2- If a < 10 and a > 50 Then
b = 0
Else
b = 99
End If
3- If amount1 >= 10 OR amount1 <= 20
Display “The amount is in the range of 10 to 20”
End If
4- Declare string number
Display “Please enter the number of the burger combo you want”
Select number
Case 1:
Display "Your ordered the beef burger special”
Case 2:
Display "You ordered a cheese-burger”
Case 3:
Display "You ordered a fish sandwich”
Case 4:
Display "The only valid combo is #1, #2, or #3”
End Select
Explanation / Answer
1-If x = 100 Then
y = 20
z = 40
End If
Answer: No Error
2- If a < 10 and a > 50 Then
b = 0
Else
b = 99
End If
Answer: No Errors
3- If amount1 >= 10 OR amount1 <= 20
Display “The amount is in the range of 10 to 20”
End If
Answer: No Errors
4- Declare string number
Display “Please enter the number of the burger combo you want”
Select number
Case 1:
Display "Your ordered the beef burger special”
Case 2:
Display "You ordered a cheese-burger”
Case 3:
Display "You ordered a fish sandwich”
Case 4:
Display "The only valid combo is #1, #2, or #3”
End Select
Answer: Error occured at Display message because message in between " "
You should include switch before using Case
break in between each switch case
Missing Default message
Modified javascript:
Switch(number)
Case 1:
Display "Your ordered the beef burger special"
break;
Case 2:
Display "You ordered a cheese-burger"
break;
Case 3:
Display "You ordered a fish sandwich"
break;
default:
Display "The only valid combo is #1, #2, or #3"
End Switch