mmsteelers
Member
- Joined
- Feb 4, 2009
- Messages
- 9
- Programming Experience
- Beginner
Hi, I have to create an application that prompts the user to enter today's sales for five stores. The program should then display a simple bar graph comparing each store's sales. Create each bar in the bar graph by displaying a row of asterisks (*) in a list box. Each asterisk in a bar represents $100 in sales. I have to make two different versions of this program. One using a "do while ... loop" and the other using a "for ... next loop". Could someone give me a hint on how to do this. I the "do while ... loop" version and I have had some problems, especially with converting the numbers to asterisks. Here is a link on how the program's gui should look:
http://www.hotlinkfiles.com/files/2296675_frroi/program.jpg
Thanks to anyone in advance who can help me
http://www.hotlinkfiles.com/files/2296675_frroi/program.jpg
Thanks to anyone in advance who can help me
VB.NET:
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
'Clear everything
lstOutput.Items.Clear()
' Demonstrate the For...Next loop.
Dim intStores As Integer ' Number of Stores
Dim intCount As Integer ' Loop counter
Dim decSales As Decimal ' To hold sales for store
Dim strAsteriks As String ' Holds asteriks
Dim strInput As String ' To get the user input
Dim strTemp As String
' Store the correct starting values in the counter
' and accumulator.
intCount = 1
intStores = 5
' The following loop gets the sales for each store.
Do While intCount <= intStores
strInput = InputBox("Enter the sales for each store " & _
intCount.ToString(), "Sales Amount Needed")
If strInput <> String.Empty Then
decSales = CDec(strInput) ' Store input in sales
intCount += 1 ' Increment the counter
strTemp = "Store " & intCount.ToString _
& ": " & decSales.ToString
lstOutput.Items.Add(strTemp)
End If
Loop
End Sub
Last edited by a moderator: