Question: This assignment provides exercises in the Selection programming structure. That is IF ... THEN ... ELSE ... END IF andIF ... THEN ... ELSEIF ...
This assignment provides exercises in the Selection programming structure. That is IF ... THEN ... ELSE ... END IF andIF ... THEN ... ELSEIF ... ELSEIF .... END IF
Open a blank Word or Text file, save this file as:yourlastname_firstname_ProgrammingSelection.docxoryourlastname_firstname_ProgrammingSelection.txt.Then type the answer to the following questions:
1. What is the value ofHowMuchafter the following has executed?
Assume i = 1 and HowMuch = 0
IF i < 5 THEN
HowMuch = HowMuch + 1
ELSEIF i = 5 THEN
HowMuch = HowMuch - 5
ELSE
HowMuch = HowMuch + 3
END IF
DISPLAY HowMuch
2. What is the value ofHowMuchafter the following has executed?
Assume i = 5 and HowMuch = 0
IF i < 5 THEN
HowMuch = HowMuch + 1
ELSEIF i = 5 THEN
HowMuch = HowMuch - 5
ELSE
HowMuch = HowMuch + 3
END IF
DISPLAY HowMuch
3. What is the value of HowMuch after the following has executed?
Assume i = 6 and HowMuch = 0
IF i < 5 THEN
HowMuch = HowMuch + 1
ELSEIF i = 5 THEN
HowMuch = HowMuch - 5
ELSE
HowMuch = HowMuch + 3
END IF
DISPLAY HowMuch
Use the following selection structure to answer the next three questions:
If intNumber<= 100 Then
intNumber = intNumber * 2
ElseIf
intNumber> 500 Then
intNumber = intNumber * 3
End If
4. Assume intNumber initially contains 50. What is the value of intNumber after the above selection structure is executed?
5. Assume intNumber initially contains 500. What is the value of intNumber after the above selection structure is executed?
6. Assume intNumber initially contains 1000.
What is the value of intNumber after the above selection structure is executed?
To receive credit for this assignment, submityour file to this assignment in Canvas. Only ONE file, please.
8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
