Important alert: (current site time 9/30/2014 1:31:35 PM EDT)
 

VB icon

Water bill

Email
Submitted on: 4/6/2000 11:53:29 AM
By: Wilton Marranzini 
Level: Beginner
User Rating: By 1 Users
Compatibility: C++ (general)
Views: 4032
(About the author)
 
     This program is designed to calculate the water bill in advance. This also checks on the accuracy of the water company's caculations.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: Water bill
// Description:This program is designed to calculate the water bill in advance. This also
checks on the accuracy of the water company's caculations.
// By: Wilton Marranzini
//
// Inputs:Previous and Current meter reading.
//
// Returns:Amount of water used in gallons and the bill in dollars and cents.
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=344&lngWId=3//for details.//**************************************

/*
Author: Wilton Marranzini
Objective:This program is designed to calculate the water bill in advance. This also
checks on the accuracy of the water company's caculations.
INPUT: Previous and Current meter reading.
OUTPUT: Amount of water used in gallons and the bill in dollars and cents.
FORMULA: Cubicfeet= Current-Previous
 Cubicfeet*7.5= gallons
 gallons/1000= answer
 answer*2.75= answer2
 anwer2+12.93=Finalanswer
ALGORITHM: 1- Obtain previous and current meter reading.
2- Calculate bill in gallons and dollars & cents.
3- Display gallons used and Bill in dollar & cents.
______________________________________________________________________________
*/
#include <iostream.h>//Lib. being used
int main()
{	float previous;//previous reading entry
	float current;//current reading entry
float wcubicf;//water in cubic feet
float wgallon;//water in gallons
float answer;//answer after i devide the gallons by 1000
float answer2;//answer of how much you are being charged
float finalanswer;//after the 12.93 is added for the quarter charged.
int screen;//to keep screen open.
cout << "Input your previous meter reading: \n";//asking user for reading.
cin >> previous; //storing reading to variable
cout << "Input your current meter reading: \n";//asking user for reading
cin >> current;//storing reading to variable
//formula to get advance billing.
wcubicf= current-previous;
wgallon= wcubicf*7.5;
answer=wgallon/1000;
answer2=answer*2.75;
finalanswer=answer2+12.93;
//end of formula.
cout<<"You are being charged $"<<finalanswer<<" for "<<wgallon<<" gallons ";
cout << "of water.";//outputting the final billing resultd
cin >> screen;//keeps screen on.
return 0; //returning value
}


Other 12 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.