exercise 9 in Chapter 16 clearly visual basics 2010
In this exercise, you code an application that calculates a water bill. The clerk at the water department will enter the current meter reading and the previous meter reading in two text boxes. The application should calculate and display the number of gallons of water used and the total charge for the water. The charge for water is $2.05 per 1000 gallons, or .00205 per gallon. Use two independent Sub procedures: one to make the calculations and the other to display the results. Call both Sub procedures from theCalculate button’s Click event procedure. Make the calculations only when the current meter reading is greater than or equal to the previous meter reading; otherwise, display an appropriate message in a message box.
Create a Visual Basic Windows application. Use the following names for the solution and project, respectively: Water Bill Solution and Water Bill Project. Save the application in the ClearlyVB2010\Chap16 folder. Change the name of the form fileon your disk to frmMain.vb. If necessary, change the form’s name to frmMain.
Create the interface shown in Figure 16-24 and then code the application. Be sure to code each text box’s KeyPress and TextChanged event procedures. Save the solution and thenstart and test the application. Close the Code Editor window and then close the solution.
iv. The message box icon should be the Error icon.The output for the total charge should be displayed in currency format.
Run the program, entering 8450 as the Current reading, and 6225 as the Previous reading. Click Calculate, then take a screen shot of the form, paste it at the end of this document, and press ENTER twice.
Clear the text boxes, and run the program again, entering 8450 as the Current reading, and 8995 as the Previous reading. Before you click Calculate, take a screen shot of the form, paste it at the end of the document and press ENTER twice.
Then click Calculate. A message box should pop up with an invalid input error message. Take a screen shot of the message box and paste it at the end of this document.
it looks good. thanks