How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask LogicPro Your Own Question
LogicPro, Engineer
Category: Homework
Satisfied Customers: 13166
Experience:  Expert in Java C++ C C# VB Javascript Design SQL HTML
Type Your Homework Question Here...
LogicPro is online now
A new question is answered every 9 seconds

exercise 9 in Chapter 16 clearly visual basics 2010

This answer was rated:

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 the
Calculate 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 file
on 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 then
start and test the application. Close the Code Editor window and then close the solution.


  1. Enlarge your form if necessary. In the bottom center area of the form, add a label with the Text property, Designed by, followed by your name.

  2. Add a button between the Calculate and Exit buttons, with the text “Clear”, and code it to clear the two input text boxes and the output labels.

  3. c.  Put five comment lines at the top of the code page, listing:
    'Project Name: Water Bill Project
    'Class: CINS 113-nn [section number]
    'Programmer: [your name]
    'Date: [date last modified]
    'Purpose: [1- or 2-line description of program]

  4. Put brief comments in all sub procedures, explaining what that section does: the button click procedure, the sub procedure for making the calculations, the sub procedure for displaying the results, as well as the Clear button and the Exit button sub procedures.

  5. Declare the rate of .00205 dollars per gallon as a constant.

  6. The variables for Current reading, Previous reading and Gallons used should be integers.

  7. Your message box for invalid input should include these things:

  8.  i.      The message should include the numbers the user entered, for example: “ERROR: Current reading (2000) cannot be less than Previous reading (3000).”                                                            ii.      The title bar text should say “Invalid Input”.                                                          iii.      The message box button should say “OK”.

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.


Welcome to JustAnswer.
My name is XXXXX XXXXX I will help you.

Provide me Figure 16-24.
If you have any file(s), Zip all files, upload the zipped file to and post download link here.
Customer: replied 4 years ago.

Please wait for 10-15 minutes.

You need to spend $3 to view this post. Add Funds to your account and buy credits.
LogicPro and 2 other Homework Specialists are ready to help you
Customer: replied 4 years ago.

it looks good. thanks