Monday, January 31, 2011

Word Problem 5 - Inglebert's Apples and Oranges

Inglebert has 15 apples and 3 times as many oranges. How many pieces of fruit does she have?
Create a program in Visual Basic to calculate the number of pieces of fruit Inglebert has with the given numbers.

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click  
'Declare variables
Dim A, O, pieces As Integer
'Set values
A = 15
O = A * 3
pieces = A + O
'Display results
MessageBox.Show("Inglebert has " & pieces & " pieces of fruit.")
End Sub
End Class

No comments:

Post a Comment