Solved

Calculates and display gallons of water used and  total charged

Posted on 2011-03-21
5
169 Views
Last Modified: 2014-10-24
Code an application so that it calculates and displays the number of gallons of water used and the total charge for water. the charge for the water is $1.75 per 1000 gallons or .00175 per gallon. Make the calculations  only when the current meter reading is greater than or equal to the previous meter reading; other wise diplay an approiate message.Displya total charge with a dollar sign and two decimals. the text boxes should only accept numbers and th backspace key.Clear number of gallons used and the total charge when a change is made to contents. when a text box receives focus, select its exsisiting text.


I have attached the zip file of what I have so far  
Allenton-Solution.sln
0
Comment
Question by:sweety53216
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 56

Expert Comment

by:HainKurt
ID: 35181886
your attached file is not showing any code... you posted solution file by mistake instead of code file...
0
 

Author Comment

by:sweety53216
ID: 35181982
ublic Class Form1

    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()

This is what I have so far

    End Sub

    Private Sub bntCalc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bntCalc.Click
        'calculates total gallons and total charge

        lbltotalgallons.Text = Val(TxtCurrent.Text) - Val(Txtprevious.Text)
        lbltotalcharge.Text = Val(lbltotalgallons.Text) * 0.00175
        lbltotalcharge.Text = Format(lbltotalcharge.Text, "currency")
0
 
LVL 56

Accepted Solution

by:
HainKurt earned 500 total points
ID: 35182160
use Convert.ToInt32

dim pRead as int = Convert.ToInt32(Txtprevious.Text)
dim cRead as int = Convert.ToInt32(TxtCurrent.Text)
dim totalCharge as double

if (pRead<cRead) then
  totalCharge  = (cRead-pRead) * 0.00175
  lbltotalcharge.Text = totalCharge.ToString("#,000.00")
end if

check here for more formatting options:

http://msdn.microsoft.com/en-us/library/kfsatb94.aspx
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question