Visual Basic assignment:


Problem #1: Write a program using a do...while loop to put out math problems using the math facts concept illustrated in the for...next examples. The user should then enter the answer. For a B on this assignment, you should evaluate the answer and tell the user whether it is right or wrong. For an A on this portion of the assignment you should give the user three chances to enter the right answer.


The program is available Introduction to loops examples.

ForNext2 Project


Public Class frmForNext2

Inherits System.Windows.Forms.Form


Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click

End

End Sub


Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click

Dim wkFirstNum As Integer

Dim wkSecondNum As Integer

Dim wkResult As Integer

Dim wkToShow As String

For wkFirstNum = 1 To 5

For wkSecondNum = 1 To 5

wkResult = wkFirstNum + wkSecondNum

wkToShow = wkFirstNum & " + " & wkSecondNum & " = " & wkResult

lstMathFacts.Items.Add(wkToShow)

Next

Next

End Sub

End Class


Problem #2: Write a program to take in a name in the format Last/First Middle (for example Doe/John M) and return the name in the format First Middle Last (for example John M Doe). I want you to do this using functions that exist in VB to do the flip.


Problem #3: Write a program that demonstrates the difference between ByVal and ByRef. Explain what you are doing with comments.