Concept explainers
Explanation of Solution
The given code:
'checking intX is less than 10
If intX < 10 Then
'Set intY equal to 0
intY = 0
'checking intX is less than 20
Elseif intX < 20 Then
'set intY equal to 1
intY = 1
'checking intX is less than 30
Elseif intX < 30 Then
'set intY equal to 2
intY = 2
'checking intX is less than 40
Elseif intX < 40 Then
'set intY eual to 3
intY 3
'if the conditions are not true
Else
'set intY equal to -1
intY = -1
'end of if condition
End If
Assume “intX” is 5
If intX < 10 Then 'checks 5<10...
Explanation of Solution
The given code:
'checking intX is less than 10
If intX < 10 Then
'Set intY equal to 0
intY = 0
'end of if condition
End If
'checking intX is less than 20
If intX < 20 Then
'set intY equal to 1
intY = 1
'end of if condition
End If
'checking intX is less than 30
If intX < 30 Then
'set intY equal to 2
intY = 2
'end of if condition
End If
'checking intX is less than 40
If intX < 40 Then
'set intY eual to 3
intY 3
'end of if condition
End If
Assume “intX” is 5.
If intX < 10 Then 'checks 5<10...
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Starting Out With Visual Basic (8th Edition)
- Write a Case clause that specifies all numbers less than 0.arrow_forwardT/F 4. The == operator can always be used to test whether two values are identical when evaluating some primitive kind of variable.arrow_forwardWrite an if-else statement that works like this: If the sales variable is greater- than or equal-to 50,000, the commissionRate variable should be assigned the value 0.2. Otherwise, the commissionRate variable should be assigned the value 0.1.arrow_forward
- Write an if-else statement that works like this: If the sales variable is greaterthan or equal-to 50,000, the commissionRate variable should be assigned the value 0.2. Otherwise, the commissionRate variable should be assigned the value 0.1.arrow_forward2. Write an if statement that assigns 1 to x if y is greater than 0.arrow_forwardUsing the following chart, write if/elif statements that assigns .10, .15, or .20 to commission, depending on the value in sales. Exit with an error message if the sales value if less than zero. Sales Commission Rate Up to $10,000 10% $10,000 to $15,000 15% Over $15,000 20%arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT