Direction: Write a program that displays the output shown in a list box. The last two lines of the output should be displayed by one or more Sub procedures using data passed by variables from an event procedure.

Problem One: Assume that the current date is 12/31/2010, the label for txtBox reads “What is your date of birth?”, and the user enters 2/3/1984 into txtBox before btnDisplay is clicked.
You are now 26 years old.
You have lived for 9824 days.

Direction: Determine the output displayed when the button is clicked

Problem Two:
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
‘Rule of 72
Dim p As Double
p = CDbl (txtPopGr.Text) ‘Population growth as a percent
txtOutput.Text = “The population will double in “ &
DoubleTime(p) & “ years."
End Sub
Function DoublingTime(ByVal x As Double) As Double
‘Number of cars that can be parked
Return 100 * x
End Function

Problem Three:
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
Dim d As Date = #12/4/2011#
txtOutput.Text = MonthAbbr(d)
End Sub
Funcion MonthAbbr(ByVal d As Date) As String
Dim str As String = FormatDateTime(d, DateFormat.LongDate)
Dim n As Integer = str.IndexOf(“ “)
Return str.Substring(n + 1, 3)
End Function

Problem One: To determine the output displayed when the button is clicked, we need to analyze the code in the event handler (btnDisplay_Click).

The code snippet provided shows that when btnDisplay is clicked, the program retrieves the population growth entered in the txtPopGr TextBox and assigns it to a variable p. Then, it calls the DoubleTime function passing the value of p as an argument. Finally, it sets the txtOutput TextBox's text property to a message that includes the result of the DoubleTime function.

To determine the output, we need to understand what the DoubleTime function does. From the code snippet, we can see that the function returns the result of multiplying the input (x) by 100. So, the output displayed in the txtOutput TextBox will be "The population will double in [DoubleTime result] years."

Problem Two: To determine the output displayed when the button is clicked, we need to analyze the code in the event handler (btnDisplay_Click).

The code snippet provided shows that when btnDisplay is clicked, the program assigns the date #12/4/2011# to the variable d, and then it calls the MonthAbbr function passing the value of d as an argument. Finally, it sets the txtOutput TextBox's text property to the result of the MonthAbbr function.

To determine the output, we need to understand what the MonthAbbr function does. From the code snippet, we can see that the function takes a Date argument, formats it using the LongDate format, finds the index of the first space character, and returns a substring of three characters starting from the index after the space character.

In this case, the provided date is #12/4/2011#. The MonthAbbr function will format it as "Sunday, December 4, 2011". Then, it finds the index of the first space character, which is at index 6. Finally, it returns a substring starting from index 7 and containing three characters ("Dec").

Therefore, the output displayed in the txtOutput TextBox will be "Dec".

To summarize:
Problem One: The output displayed will be "The population will double in [DoubleTime result] years."
Problem Two: The output displayed will be "Dec".