Question
In these Exercises of decisions from programming in Visual Basics, determine the output displayed in the text box when clicking the button. Private Sub btnDisplay_Click(...)
In these Exercises of decisions from programming in Visual Basics, determine the output displayed in the text box when clicking the button.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim num As Double = 4 If num <= 9 Then
txtOutput.Text = "Less than ten."
Else
If num = 4 Then
txtOutput.Text = "Equal to four."
End If
End If
End Sub
2. Private Sub btnDisplay_Click(...) Handles btnDisplay. Click
Dim change As Double = 356 'Amount of change in cents
If change >= 100 Then
txtOutput.Text = "Your change contains " &
Int(change / 100) & " dollars."
Else
txtOutput.Text = "Your change contains no dollars."
End If
End Sub
3. Private Sub btnCompute_Click(...) Handles btnCompute.Click Dim msg As String = "You are old enough to vote" Dim dateOfBirth As Date = CDate(InputBox("Enter your date of birth."))
If dateOfBirth.AddYears (18) <= Today Then
txtOutput.Text = msg & "."
Else
txtOutput.Text = msg & " in " &
DateDiff(DateInterval.Day, Today, dateOfBirth.AddYears(18)) &
" days."
End If
End Sub
(Assume that your 18th birthday is one week away.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started