Patricia – 286 words – College Essay

essay A+

Get Full Essay

Get access to this section to get all the help you need with your essay and educational goals.

Get Access

TMA MT264 02Question 1Public Class TicketAdminDim fProductions As New Dictionary(Of String, Integer) Public ReadOnly Property Productions As Dictionary(Of String, Integer)GetReturn fProductionsEnd GetEnd Property Public Sub New()fProductions = New Dictionary(Of String, Integer)fProductions.Add(“Carmen”, 0)fProductions.Add(“Don Giovanni”, 0)fProductions.Add(“How The Whale Became”, 0)fProductions.

Add(“Manon”, 0)fProductions.Add(“Peter Grimes”, 0)End SubPublic Sub incrementCount(ByVal Production As String)If Productions.ContainsKey(Production) ThenfProductions.Item(Production) = Productions.Item(Production) + 1End IfEnd SubEnd ClassQuestion 2This question is based on Unit 5.For index As Integer From 0 To (wordArray.

Length ? 1)The for loop is started by using the For keyword. This tells Visual Basic 2010 that you want to create a loop. Everything that follows the For keyword is used to define how the loop should act. In this case, you’re giving it the variable you just created and then telling it to count from 1 to 5: The variable that you give the loop (in this case, intCount) is known as the control variable. When you first enter the loop, Visual Basic 2010 sets the control variable to the initial count value — in this case, 1. After the loop starts, Visual Basic 2010 moves to the first line within the For loop — in this case, the line that adds a string to the list box:This time, this line of code adds I’m item 2 in the list! to the list box.

Again, after this line is executed, you run the Next statement. The value of intCount is now incremented from 2 to 3, and because 3 is lessthan or equal to 5, you move back to the line that adds the item to the list. This happens until intCount is incremented from 5 to 6. Because 6 is greater than the stop value for the…

Get access to
knowledge base

MOney Back
No Hidden
Knowledge base
Become a Member