Thursday 17 July 2014

Write a Program in C++ Which Compute Monthly Water Bill

1. Previous Units
2. Current  Units
3. Total Bill



Structure of the Problem Requirements 

In this Problem we Need to Calculate the Monthly Water Bill . This Problem Concern with Mathematical Problem and Solutions and for Calculating this we Need Previous Unit and Current Unit .When we Subtract Previous Unit From Current Unit we Get the Monthly Unit of Water.

Source Code

#include <iostream>
using namespace std;
int main ()
{
cout<<endl<<endl<<"*************** WATER BILL CALCULATION ***************"<<endl<<endl;
char ch;
do
{
int previous_meter_reading;             //Declare the Variable
int current_meter_reading; //Declare the Variable
int demand_charge=350; //Intilize the Variable
int charge_per_gallon=10; //Intilize the Variable
int surcharge=50; //Intilize the Variable
int gallons; //Declare the Variable
int bill; //Declare the Variable
  char unpaid_balance; //Declare the Variable
cout<<endl<<"Please Enter Previous Meter Reading: ";
cin>>previous_meter_reading; // User Input the Last Record Unit
cout<<endl<<"Please Enter Current Meter Reading: ";
cin>>current_meter_reading; // User Input the Current Record Unit
cout<<endl<<"Did Customer Paid The Previous Bill? (Press 'Y' or 'N'): ";
cin>>unpaid_balance; //User Can Pay the Last bill or not
gallons=current_meter_reading-previous_meter_reading;
if (unpaid_balance== 'Y') // If yes then it subtracted from current one
{
bill=(charge_per_gallon*gallons)+demand_charge;
}
else
{
bill=(charge_per_gallon*gallons)+demand_charge+surcharge; // If not then it subtracted from current one
}
cout<<endl<<"Water Bill="<<bill<<"Rs."<<endl;
cout<<endl<<"=============================================================="<<endl;
cout<<"Do you Want More (Y / N) : "; //Asking 4 more if not then press N and Exist Programme
cin>>ch;
}while(ch=='y--');
return 0;
}

Output of the Program


Compute Water Billing System
Compute Monthly Water Billing System






Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

2 comments: Post Yours! Read Comment Policy!▼
Important Note:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

  1. plz upload the large project of software like banking system voting management etc ,,, for for that

    ReplyDelete
  2. We will Soon Upload these types of Project ... For beginner it is difficult to understand Large Project...!!!

    ReplyDelete