Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Const sngSQF As Single = 115 'Const 115 sq/ft of wall space is one gallon of paint
Const intHours As Integer = 8 'Const 8 hours of labor required per gallon of paint.
Const decSalary As Decimal = 18.0 'Salary of labor per hour.
Dim intRooms As Integer 'Number of rooms needed to be painted
Dim intCount As Integer 'Loop Count
Dim sngArea As Single 'To hold the area.
Dim sngTotalArea As Single 'Use as an accumulator
Dim strInput As String 'To get the area input
intCount = 1
sngTotalArea = 0
intRooms = CInt(txtRooms.Text)
' Following loop gets the area of each room.
Do While intCount <= intRooms
strInput = InputBox("Enter the area of room " & intCount.ToString, "Input Needed")
If strInput <> "" Then
sngArea = CInt(strInput)
sngTotalArea += sngArea
intCount += 1
End If
Loop
lblPaint.Text = sngTotalArea / sngSQF
Dim sngPaint As Single
sngPaint = CSng(lblPaint.Text)
lblLabor.Text = sngPaint * intHours
Dim decPaintPrice As Decimal
decPaintPrice = CDec(txtPaintPrice.Text)
Dim decPaintCost As Decimal
decPaintCost = sngPaint * decPaintPrice
lblPaintCost.Text = FormatCurrency(decPaintCost)
Dim sngLabor As Single
sngLabor = CSng(lblLabor.Text)
Dim decLaborCost As Decimal
decLaborCost = sngLabor * decSalary
lblLaborCost.Text = FormatCurrency(decLaborCost)
Dim decTotal As Decimal
decTotal = decLaborCost + decPaintCost
lblTotal.Text = FormatCurrency(decTotal)
End Sub