This program is supposed to prompt for a price until (do while loop) the input box is blank and then average the numbers and display the average. I've got most of it down except the average part, how do I store the numbers the professor hasn't showed us arrays yet. Any help would be appreciated :S

Public Class Form1
    Private Sub btnSales_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSales.Click
        'use input box and message box to receive results of sales of several items and find the average and print 
        'it in a message box. use an input box to accumulate numbers, prompting everytime for number, loop until
        'use do while loop with counter
        'do while inputsales <> string.empty (as long as it not empty)
        Dim inputSales As String
        Dim title1 As String = "Sales Input form"
        Dim averageTitle As String = "The average of the sales is"
        Dim prompt As String = "Input the Amount of the Sale"
        Dim totalSales As Integer
        Dim average As Decimal
        Dim iCounter As Integer

        iCounter = 0
        average = 0
        Do
            inputSales = InputBox(prompt, title1, "")
            'totalSales = ??????
            iCounter = iCounter + 1
            'average = totalSales / iCounter
            'MessageBox.Show(inputSales, averageTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)

        Loop While inputSales <> String.Empty
        average = totalSales / iCounter
        MessageBox.Show(inputSales, averageTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)

    End Sub
End Class

:confused:

If inputSales <> "" Then
  totalSales = totalSales + inputSales
End If

and then show average:

MessageBox.Show(average, averageTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)

Hope this makes you happy (and your professor) ;)

commented: a great help, Thank You +2

Thank you great, looks like it works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.