Lab6: Canton Water Department
Lab6 requires you to create the following:
Your lab needs to include the following:
I will send the rest in another question
Start
Declare variable previousMeterReading As Double
Input previousMeterReading
Declare variable currentMeterReading As Double
Input currentMeterReading
Declare variable gallonsWaterUsed As Double
Set gallonsWaterUsed=currentMeterReading - previousMeterReading
Declare variable totalChargeWater As Double
Set totalChargeWater=19.5 + 0.00175 * gallonsWaterUsed
Display gallonsWaterUsed
Display totalChargeWater
Stop
Form
Code:
Public Class Form1
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim previousMeterReading As Double = Double.Parse(txtPreviousMeterReading.Text)
Dim currentMeterReading As Double = Double.Parse(txtCurrentMeterReading.Text)
Dim gallonsWaterUsed As Double = currentMeterReading - previousMeterReading
Dim totalChargeWater As Double = 19.5 + 0.00175 * gallonsWaterUsed
txtGallonsWaterUsed.Text = gallonsWaterUsed.ToString("N")
txtTotalChargeWater.Text = totalChargeWater.ToString("C")
End Sub
End Class
Comments
Leave a comment