SlideShare a Scribd company logo
#include<iostream>
#include<string>
#include<iomanip>
#include<fstream>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cmath>
#include<Windows.h>
using namespace std;
SYSTEMTIME*p_st=new SYSTEMTIME;
typedef unsigned long long Type;
Type myRand(const Type Max, const Type Min = 0)
{
return rand()/(float)RAND_MAX * (Max-Min) + Min ;
}
int main()
{
srand(time(0));
char sdate[9];
_strdate_s( sdate );
int number=rand()%999999+100000;
int customer=rand()%999999+100000;
int watermeter=rand()%99999999+10000000;
int gasmeter=rand()%99999+10000;
int electric=rand()%99999+10000;
int watermeter2=rand()%99999999+10000000;
int gasmeter2=rand()%99999+10000;
int electric2=rand()%99999+10000;
int watermeter3=rand()%99999999+10000000;
int gasmeter3=rand()%99999+10000;
int electric3=rand()%99999+10000;
int c=rand()%9999+1000;
int b=rand()%99999+10000;
int account=211012222222;
double avaicharge=0.00;
double previousbalance;
double payments=0.00;
double balance=0.00;
double water=17.08;
double gas=12.26;
double trash=16.50;
double tax=8.46;
double misc=0.44;
double total=280.00;
double gross=294.00;
double net=280.00;
bool arrangements;
int presentreadingwater=0;
int presentreadinggas=0;
int presentreadingelectric=0;
int presentreadingsewer=0;
int days=30;
int invnumber=rand()%99999+10000;
int invnumber2=rand()%999999+100000;
srand(unsigned(time(0)));
const Type MAX = 99999999999;
const Type MIN = 10000000000;
double consg;
double conse;
double chargee=8.88;
double consw;
double chonsw=3.84;
double watercons1=(3000*0.001240);
double watercons2=(3000*0.001550);
double watercons3=(2900*0.001680);
double avaichargewater=3.84;
double consgas=(800*0.009700);
double avaichargegas=4.50;
double avaichargeelectric=8.88;
double elecons1=(1400*0.082720);
double elecons2=(667*0.090730);
double electricbill(double chargee, double conse);
double gasbill(double consg);
double waterbill(double chonsw,double consw);
double sewercons=0.0045;
char input[7];
const char password[7]="jeremy";
GetSystemTime(p_st);
cout<<sdate<<endl;
cout<<"Please enter your password: "<<endl;
cin>>input;
if(strcmp(input,"jeremy")!=0)
{
cout<<"Invalid password"<<endl;
}
else
{
cout<<"Correct password"<<endl;
ifstream inFile;
ofstream outFile;
outFile.open("Utility2.dat",ios::out|ios::app);
cout<<"Please enter the gas usage: "<<endl;
cin>>consg;
cout<<gasbill(consg)<<endl;
cout<<"Please enter the electricity usage: "<<endl;
cin>>conse;
cout<<electricbill(chargee,conse)<<endl;
cout<<"Please enter you're water usage: "<<endl;
cin>>consw;
cout<<fixed<<showpoint<<setprecision(2)<<waterbill(chonsw,consw)<<endl;
cout<<"Please enter the customer's previous balance: ";
cin>>previousbalance;
if(previousbalance<0)
{
cout<<"Have any arrangements been made?";//answer in true or false
cin>>arrangements;
}
if(arrangements=true)
{
cout<<"Power is on";
}
else if(arrangements=false)
{
cout<<"A $30 fee has been added to turn your power back on";
}
outFile<<setw(18)<<"Customer Name";
outFile<<right<<setw(36)<<"Customer Number: "<<customer<<c<<endl;
cout<<right;
outFile<<setw(18)<<"UTILITY CUSTOMER"<<right<<setw(36)<<"Account Number:
"<<number<<b<<endl;
outFile<<right<<setw(36)<<"www.hsvutil.org";
outFile<<right<<setw(19)<<"Pay Gross After: "<<p_st->wMonth<<"/"<<p_st-
>wDay+10<<"/"<<p_st->wYear<<endl;
outFile<<right;
outFile<<setw(18)<<"Service Address"<<setw(35)<<"Net Amount Due:$
"<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash)-(previousbalance)*.03<<endl;
outFile<<endl;
outFile<<endl;
outFile<<"123 ANY STREET"<<endl;
outFile<<right<<setw(18);
outFile<<"HUNTSVILLE AL"<<setw(34)<<"Invoice Date: "<< p_st->wMonth<<"/"<<p_st-
>wDay<<"/"<<p_st->wYear<<endl;
outFile<<right<<setw(21)<<"|Bill due upon receipt. Data above applies to current
charges and not to previous balance. |"<<endl;
outFile<<right<<setw(18)<<"Messages"<<right<<setw(80)<<"|Account Summary
|"<<endl;
outFile<<right<<setw(64)<<"|Previous Balance
"<<right<<setw(17)<<"$"<<previousbalance<<right<<setw(13)<<"|"<<endl;
outFile<<"|*PUBLICLY-OWNED, NOT-FOR-PROFIT--RELIABLE
|Payments"<<right<<setw(26)<<"$"<<payments<<right<<setw(13)<<"|"<<endl;
outFile<<"SERVICES-LOWER RATES"<<right<<setw(42)<<"|Balance
Forward"<<right<<setw(27)<<"$"<<balance<<" |"<<endl;
outFile<<"Please be advised that your meter reading date"<<"|Current
Charge"<<endl;
outFile<<right<<setw(20)<<"Service Period: "<<right<<setw(27)<<"|"<<endl;
outFile<<"was May 5, 2011."<<right<<setw(37)<<"|Water "<<right<<setw(20)<<"$
"<<fixed<<showpoint<<setprecision(2)<<waterbill(chonsw,consw)<<endl;
outFile<<right<<setw(50)<<"|Gas"<<right<<setw(23)<<" $
"<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)<<endl;
outFile<<right<<setw(55)<<"|Electric"<<right<<setw(18)<<"$
"<<fixed<<showpoint<<setprecision(2)<<electricbill(chargee,conse)<<endl;
outFile<<right<<setw(52)<<"|Sewer"<<right<<setw(21)<<"$
"<<fixed<<showpoint<<setprecision(2)<<sewercons<<endl;
outFile<<right<<setw(52)<<"|Trash"<<right<<setw(21)<<"$
"<<fixed<<showpoint<<setprecision(2)<<trash<<endl;
outFile<<right<<setw(50)<<"|Tax"<<right<<setw(23)<<"$
"<<fixed<<showpoint<<setprecision(2)<<(gasbill(consg)+electricbill(chargee,conse)+waterbi
ll(chonsw,consw)+sewercons+trash)*.03<<right<<setw(15)<<endl;
outFile<<right<<setw(60)<<"|Miscellaneous"<<right<<setw(13)<<"$
"<<fixed<<showpoint<<setprecision(2)<<misc<<endl;
outFile<<right<<setw(68)<<"|Total Current Charges"<<right<<setw(19)<<"$
"<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash)*.03<<endl;
outFile<<right<<setw(63)<<"|Gross Amount Due"<<right<<setw(24)<<"$
"<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash)-(previousbalance)*.03<<" |"<<endl;
outFile<<right<<setw(61)<<"|Net Amount Due"<<right<<setw(26)<<"$
"<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash)-(previousbalance)*.03<<" |"<<endl;
outFile<<setw(60)<<"___"<<endl;
outFile<<right<<setw(22)<<"Meter Reading Details"<<right<<setw(28)<<"Degree Days:
Past 336"<<right<<setw(14)<<"Present 132"<<endl;
outFile<<"________________________________________________________________________
____________________________________________________"<<endl;
outFile<<"|Service"<<right<<setw(10)<<"Meter"<<right<<setw(9)<<"Read"<<right<<setw
(13)<<"Previous"<<right<<setw(12)<<"Previous"<<right<<setw(10)<<"Present"<<right<<setw(14
)<<"Present"
<<right<<setw(9)<<"No. of"<<right<<setw(9)<<"Monthly"<<right<<setw(32)<<"Billed
Usage|"<<endl;
outFile<<"|Type"<<right<<setw(13)<<"Number"<<right<<setw(9)<<"Type"<<right<<setw(1
4)<<"Read Date"<<right<<setw(10)<<"Reading"<<right<<setw(13)<<"Read
Date"<<right<<setw(12)<<"Reading"<<
right<<setw(8)<<"Days"<<right<<setw(9)<<"Usage"<<right<<setw(14)<<"Multiplier"<<ri
ght<<setw(19)<<" |"<<endl;
outFile<<"|Water"<<right<<setw(12)<<watermeter<<right<<setw(10)<<"Actual"<<right<<
setw(6)<<p_st->wMonth-1<<"/"<<p_st->wDay<<"/"<<p_st-
>wYear<<right<<setw(10)<<watermeter2<<right<<setw(5)<<p_st->wMonth<<"/"<<p_st-
>wDay<<"/"<<p_st-
>wYear<<right<<setw(13)<<watermeter3<<right<<setw(7)<<days<<right<<setw(10)<<consw<<right
<<setw(26)<<consw<<" GAL|"<<endl;
outFile<<"|Gas"<<right<<setw(14)<<gasmeter<<right<<setw(10)<<"Actual"<<right<<setw
(6)<<p_st->wMonth-1<<"/"<<p_st->wDay<<"/"<<p_st-
>wYear<<right<<setw(10)<<gasmeter2<<right<<setw(5)<<p_st->wMonth<<"/"<<p_st-
>wDay<<"/"<<p_st-
>wYear<<right<<setw(13)<<gasmeter3<<right<<setw(7)<<days<<right<<setw(10)<<consg<<right<<
setw(26)<<consg<<" CUF|"<<endl;
outFile<<"|Electric"<<right<<setw(9)<<electric<<right<<setw(10)<<"Actual"<<right<<
setw(6)<<p_st->wMonth-1<<"/"<<p_st->wDay<<"/"<<p_st-
>wYear<<right<<setw(10)<<electric2<<right<<setw(5)<<p_st->wMonth<<"/"<<p_st-
>wDay<<"/"<<p_st-
>wYear<<right<<setw(13)<<electric3<<right<<setw(7)<<days<<right<<setw(10)<<conse<<right<<
setw(26)<<conse<<" KWH|"<<endl;
outFile<<"|Sewer"<<right<<setw(12)<<watermeter<<right<<setw(10)<<"Actual"<<right<<
setw(6)<<p_st->wMonth-1<<"/"<<p_st->wDay<<"/"<<p_st-
>wYear<<right<<setw(10)<<watermeter2<<right<<setw(5)<<p_st->wMonth<<"/"<<p_st-
>wDay<<"/"<<p_st->wYear<<right<<setw(13)
<<watermeter3<<right<<setw(7)<<days<<right<<setw(10)<<
consw<<right<<setw(26)<<consw<<" GAL|"<<endl;
outFile<<"------------------------------------------------------------------------
----------------------------------------------------"<<endl;
outFile<<right<<setw(70)<<"*********************FINAL
NOTICE*********************"<<endl;
outFile<<"This is to notify you that it may be necessary to discontinue your
utility service as of 05/24/11 unless prompt payment of this invoice or"<<endl;
outFile<<"satisfactory arrangement for payment is made before this date. Payment
in full or satisfactory payment arrangements made before"<<endl;
outFile<<"05/24/11 will avoid any reconnection or collection charges. If you have
any questions or disputes concerning your account, you should"<<endl;
outFile<<"contact us in person, by telephone at (256) 535-1200 or toll free at
(866) 478-8845 before 05/24/11. A review procedure is also available"<<endl;
outFile<<"to all our customers through which problems or disputes may be resolved;
copies are available at the utilities office. Call (256) 535-1200 to"<<endl;
outFile<<"make payment agreements by phone. Have your account number and pin
number available. No further notice will be provided."<<endl;
outFile<<endl;
outFile<<right<<setw(35)<<"Please return bottom portion with your payment."<<endl;
outFile<<"________________________________________________________________________
___________________________________________________"<<endl;
outFile<<right<<setw(30)<<"Account number "<<account<<right<<setw(30)<<"Pay Gross
After"<<right<<setw(17)<<p_st->wMonth<<"/"<<p_st->wDay+10<<"/"<<p_st->wYear<<endl;
outFile<<right<<setw(65)<<"Net Amount Due"<<right<<setw(18)<<"$
"<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil
l(chonsw,consw)+sewercons+trash)-(previousbalance)*.03<<endl;
outFile<<endl;
outFile<<endl;
outFile<<right<<setw(55)<<"_______________________________________"<<endl;
outFile<<right<<setw(55)<<"|Total Amount Paid| |"<<endl;
outFile<<right<<setw(55)<<"| Project Share| |"<<endl;
outFile<<right<<setw(55)<<"---------------------------------------"<<endl;
outFile<<right<<setw(55)<<"HUNTSVILLE UTILITIES"<<endl;
outFile<<right<<setw(55)<<"HUNTSVILLE, AL 35895"<<endl;
outFile<<endl;
outFile<<right<<setw(18)<<"UTILITY CUSTOMER"<<endl;
outFile<<right<<setw(18)<<"123 ANY STREET"<<endl;
outFile<<right<<setw(18)<<"HUNTSVILLE AL 35803"<<endl;
outFile<<right<<setw(70)<<"Invoice Number: "<<invnumber<<invnumber2<<endl;
outFile<<endl;
outFile<<"Charge Details"<<endl;
outFile<<"Water-RWM-22/Residential Water HSV ("<<p_st->wMonth-1<<"/"<<p_st-
>wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30
days)"<<endl;
outFile<<" Availability Charge"<<right<<setw(34)<<avaicharge<<endl;
outFile<<" Consumption Charge"<<right<<setw(30)<<"3000 GAL
@0.001240"<<right<<setw(8)<<"3.72"<<endl;
outFile<<right<<setw(49)<<"3000 GAL @0.001550"<<right<<setw(8)<<"4.65"<<endl;
outFile<<right<<setw(49)<<"2900 GAL
@0.001680"<<right<<setw(8)<<"4.87"<<right<<setw(9)<<"Total "<<waterbill(chonsw,consw);
outFile<<endl;
outFile<<"Gas-RGM-22/Residential Gas ("<<p_st->wMonth-1<<"/"<<p_st-
>wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30
days)"<<endl;
outFile<<" Availability Charge"<<right<<setw(37)<<"4.50"<<endl;
outFile<<" Consumption Charge"<<right<<setw(31)<<"800 CUF
@0.009700)"<<right<<setw(9)<<consgas<<" Total $"<<gasbill(consg)<<endl;
outFile<<endl;
outFile<<"Electric-REM-22/Residential Electricity ("<<p_st->wMonth-1<<"/"<<p_st-
>wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30
days)"<<endl;
outFile<<" Availability Charge"<<right<<setw(38)<<avaichargeelectric<<endl;
outFile<<" Consumption Charge"<<right<<setw(29)<<"1400
KWH@0.082720"<<right<<setw(11)<<elecons1<<endl;
outFile<<right<<setw(48)<<"667
KWH@0.090730"<<right<<setw(12)<<elecons2<<right<<setw(7)<<"Total
$"<<electricbill(chargee,conse)<<endl;
outFile<<"________________________________________________________________________
________"<<endl;
outFile<<"Sewer-RSM-22/Residential Sewer ("<<p_st->wMonth-1<<"/"<<p_st-
>wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30
days) |"<<endl;
outFile<<" Sewer Consumption Charge"<<right<<setw(20)<<"8900
GAL@0.004500"<<right<<setw(11)<<sewercons<<"
Total"<<sewercons<<right<<setw(13)<<"|"<<endl;
outFile<<right<<setw(81)<<"|"<<endl;
outFile<<"Trash-RTU-22/Residential Trash HSV city ("<<p_st->wMonth-1<<"/"<<p_st-
>wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30
days)"<<right<<setw(9)<<"|"<<endl;
outFile<<" Trash Charge"<<right<<setw(46)<<trash<<" Total $"<<trash<<endl;
outFile<<"------------------------------------------------------------------------
---------"<<endl;
outFile<<"Tax"<<right<<setw(60)<<(gasbill(consg)+electricbill(chargee,conse)+water
bill(chonsw,consw)+sewercons+trash)*.03<<" Total
$"<<(gasbill(consg)+electricbill(chargee,conse)+waterbill(chonsw,consw)+sewercons+trash)*
.03<<endl;
outFile<<endl;
outFile<<endl;
outFile<<endl;
outFile<<endl;
outFile<<endl;
outFile<<endl;
outFile<<endl;
outFile<<endl;
outFile<<"Huntsville Utilities"<<right<<setw(40)<<"Telephone Numbers"<<endl;
outFile<<"TO REPORT AN OUTAGE-(256)53-LIGHT 535-
4448"<<right<<setw(25)<<"Huntsville City Garbage-(256) 883-3964"<<endl;
outFile<<"FOR ALL OTHER CUSTOMER INQUIRIES (256) 535-1200/Toll Free 866-478-
8845"<<" Huntsville City Sewer-(256) 883-3719"<<endl;
outFile<<"Have account number and pin number available"<<right<<setw(25)<<"Madison
County Garbage-(256) 532-3718"<<endl;
outFile<<"PAYMENT BY CREDIT CARD/SPEEDPAY 1-877-429-
4131"<<right<<setw(25)<<"Madison County Water-(256) 746-2888"<<endl;
outFile<<right<<setw(45)<<"City of New Hope-(256) 723-2616"<<endl;
outFile<<"________________________________________________________________________
________"<<endl;
outFile<<endl;
}
return 0;
}
double gasbill(double consg)
{
double bill;
if(consg>4000)
bill=0.090739*consg;
else
bill=0.08272*consg;
return bill;
}
double electricbill(double chargee,double conse)
{
double electric;
if(conse>4000)
electric=0.09073*conse+chargee;
else
electric=0.08272*conse+chargee;
return electric;
}
double waterbill(double chonsw,double consw)
{
if(consw>4000)
chonsw=0.00168*consw;
else if(consw>3000)
chonsw=0.00155*consw;
else
chonsw=0.00168*consw;
return chonsw;
}

More Related Content

Viewers also liked

Ember
EmberEmber
Emarketing Paris 2012 : Awards
Emarketing Paris 2012 : AwardsEmarketing Paris 2012 : Awards
Emarketing Paris 2012 : Awards
François-Yves Prigent
 
Teksavers is a Leading Cisco Reseller in Austin
Teksavers is a Leading Cisco Reseller in AustinTeksavers is a Leading Cisco Reseller in Austin
Teksavers is a Leading Cisco Reseller in Austin
Chris Miller
 
Weather elements and factors
Weather elements and factorsWeather elements and factors
Weather elements and factorsShabana Yasmin
 

Viewers also liked (6)

Ember
EmberEmber
Ember
 
La prepa
La prepaLa prepa
La prepa
 
Rapport 2
Rapport 2Rapport 2
Rapport 2
 
Emarketing Paris 2012 : Awards
Emarketing Paris 2012 : AwardsEmarketing Paris 2012 : Awards
Emarketing Paris 2012 : Awards
 
Teksavers is a Leading Cisco Reseller in Austin
Teksavers is a Leading Cisco Reseller in AustinTeksavers is a Leading Cisco Reseller in Austin
Teksavers is a Leading Cisco Reseller in Austin
 
Weather elements and factors
Weather elements and factorsWeather elements and factors
Weather elements and factors
 

Similar to Utility bill project.doc

Hey, looking to do the following with this programFill in the multip.pdf
Hey, looking to do the following with this programFill in the multip.pdfHey, looking to do the following with this programFill in the multip.pdf
Hey, looking to do the following with this programFill in the multip.pdf
rupeshmehta151
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd marchRajeev Sharan
 
program C++ Atm
program C++ Atmprogram C++ Atm
program C++ Atm
Reynes E. Tekay
 
Computer Science Project on Management System
Computer Science Project on Management System Computer Science Project on Management System
Computer Science Project on Management System
SajidAli643
 
Stl algorithm-Basic types
Stl algorithm-Basic typesStl algorithm-Basic types
Stl algorithm-Basic types
mohamed sikander
 
CBSE Class XI Programming in C++
CBSE Class XI Programming in C++CBSE Class XI Programming in C++
CBSE Class XI Programming in C++
Pranav Ghildiyal
 
#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c
MoseStaton39
 
#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c
SilvaGraf83
 
#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c
SilvaGraf83
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
Chris Ohk
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdf
kavithaarp
 
In a few short paragraphs, explain which cloud services you use (G
In a few short paragraphs, explain which cloud services you use (GIn a few short paragraphs, explain which cloud services you use (G
In a few short paragraphs, explain which cloud services you use (G
MalikPinckney86
 
Laporan pd kelompok 6
Laporan pd kelompok 6Laporan pd kelompok 6
Laporan pd kelompok 6
phoe3
 
Programming assignment 30 12-11
Programming assignment 30 12-11Programming assignment 30 12-11
Programming assignment 30 12-11
Bilal Maqbool ツ
 
10 template code program
10 template code program10 template code program
10 template code program
Bint EL-maghrabi
 
C++ programming
C++ programmingC++ programming
C++ programming
Pranav Ghildiyal
 
Program membalik kata
Program membalik kataProgram membalik kata
Program membalik katahaqiemisme
 

Similar to Utility bill project.doc (20)

project
projectproject
project
 
Hey, looking to do the following with this programFill in the multip.pdf
Hey, looking to do the following with this programFill in the multip.pdfHey, looking to do the following with this programFill in the multip.pdf
Hey, looking to do the following with this programFill in the multip.pdf
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
 
program C++ Atm
program C++ Atmprogram C++ Atm
program C++ Atm
 
Computer Science Project on Management System
Computer Science Project on Management System Computer Science Project on Management System
Computer Science Project on Management System
 
Stl algorithm-Basic types
Stl algorithm-Basic typesStl algorithm-Basic types
Stl algorithm-Basic types
 
CBSE Class XI Programming in C++
CBSE Class XI Programming in C++CBSE Class XI Programming in C++
CBSE Class XI Programming in C++
 
#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c
 
#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c
 
#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c#include Status.hnamespace sdds{StatusStatus(c
#include Status.hnamespace sdds{StatusStatus(c
 
project3
project3project3
project3
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdf
 
In a few short paragraphs, explain which cloud services you use (G
In a few short paragraphs, explain which cloud services you use (GIn a few short paragraphs, explain which cloud services you use (G
In a few short paragraphs, explain which cloud services you use (G
 
Laporan pd kelompok 6
Laporan pd kelompok 6Laporan pd kelompok 6
Laporan pd kelompok 6
 
Programming assignment 30 12-11
Programming assignment 30 12-11Programming assignment 30 12-11
Programming assignment 30 12-11
 
10 template code program
10 template code program10 template code program
10 template code program
 
Add invoice
Add invoiceAdd invoice
Add invoice
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Program membalik kata
Program membalik kataProgram membalik kata
Program membalik kata
 

Utility bill project.doc

  • 1. #include<iostream> #include<string> #include<iomanip> #include<fstream> #include<cstdlib> #include<cstring> #include<ctime> #include<cmath> #include<Windows.h> using namespace std; SYSTEMTIME*p_st=new SYSTEMTIME; typedef unsigned long long Type; Type myRand(const Type Max, const Type Min = 0) { return rand()/(float)RAND_MAX * (Max-Min) + Min ; } int main() { srand(time(0)); char sdate[9]; _strdate_s( sdate ); int number=rand()%999999+100000; int customer=rand()%999999+100000; int watermeter=rand()%99999999+10000000; int gasmeter=rand()%99999+10000; int electric=rand()%99999+10000; int watermeter2=rand()%99999999+10000000; int gasmeter2=rand()%99999+10000; int electric2=rand()%99999+10000; int watermeter3=rand()%99999999+10000000; int gasmeter3=rand()%99999+10000; int electric3=rand()%99999+10000; int c=rand()%9999+1000; int b=rand()%99999+10000; int account=211012222222; double avaicharge=0.00; double previousbalance; double payments=0.00; double balance=0.00; double water=17.08; double gas=12.26; double trash=16.50; double tax=8.46; double misc=0.44; double total=280.00; double gross=294.00; double net=280.00; bool arrangements; int presentreadingwater=0; int presentreadinggas=0; int presentreadingelectric=0;
  • 2. int presentreadingsewer=0; int days=30; int invnumber=rand()%99999+10000; int invnumber2=rand()%999999+100000; srand(unsigned(time(0))); const Type MAX = 99999999999; const Type MIN = 10000000000; double consg; double conse; double chargee=8.88; double consw; double chonsw=3.84; double watercons1=(3000*0.001240); double watercons2=(3000*0.001550); double watercons3=(2900*0.001680); double avaichargewater=3.84; double consgas=(800*0.009700); double avaichargegas=4.50; double avaichargeelectric=8.88; double elecons1=(1400*0.082720); double elecons2=(667*0.090730); double electricbill(double chargee, double conse); double gasbill(double consg); double waterbill(double chonsw,double consw); double sewercons=0.0045; char input[7]; const char password[7]="jeremy"; GetSystemTime(p_st); cout<<sdate<<endl; cout<<"Please enter your password: "<<endl; cin>>input; if(strcmp(input,"jeremy")!=0) { cout<<"Invalid password"<<endl; } else { cout<<"Correct password"<<endl; ifstream inFile; ofstream outFile; outFile.open("Utility2.dat",ios::out|ios::app); cout<<"Please enter the gas usage: "<<endl; cin>>consg; cout<<gasbill(consg)<<endl; cout<<"Please enter the electricity usage: "<<endl; cin>>conse; cout<<electricbill(chargee,conse)<<endl; cout<<"Please enter you're water usage: "<<endl; cin>>consw; cout<<fixed<<showpoint<<setprecision(2)<<waterbill(chonsw,consw)<<endl;
  • 3. cout<<"Please enter the customer's previous balance: "; cin>>previousbalance; if(previousbalance<0) { cout<<"Have any arrangements been made?";//answer in true or false cin>>arrangements; } if(arrangements=true) { cout<<"Power is on"; } else if(arrangements=false) { cout<<"A $30 fee has been added to turn your power back on"; } outFile<<setw(18)<<"Customer Name"; outFile<<right<<setw(36)<<"Customer Number: "<<customer<<c<<endl; cout<<right; outFile<<setw(18)<<"UTILITY CUSTOMER"<<right<<setw(36)<<"Account Number: "<<number<<b<<endl; outFile<<right<<setw(36)<<"www.hsvutil.org"; outFile<<right<<setw(19)<<"Pay Gross After: "<<p_st->wMonth<<"/"<<p_st- >wDay+10<<"/"<<p_st->wYear<<endl; outFile<<right; outFile<<setw(18)<<"Service Address"<<setw(35)<<"Net Amount Due:$ "<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash)-(previousbalance)*.03<<endl; outFile<<endl; outFile<<endl; outFile<<"123 ANY STREET"<<endl; outFile<<right<<setw(18); outFile<<"HUNTSVILLE AL"<<setw(34)<<"Invoice Date: "<< p_st->wMonth<<"/"<<p_st- >wDay<<"/"<<p_st->wYear<<endl; outFile<<right<<setw(21)<<"|Bill due upon receipt. Data above applies to current charges and not to previous balance. |"<<endl; outFile<<right<<setw(18)<<"Messages"<<right<<setw(80)<<"|Account Summary |"<<endl; outFile<<right<<setw(64)<<"|Previous Balance "<<right<<setw(17)<<"$"<<previousbalance<<right<<setw(13)<<"|"<<endl; outFile<<"|*PUBLICLY-OWNED, NOT-FOR-PROFIT--RELIABLE |Payments"<<right<<setw(26)<<"$"<<payments<<right<<setw(13)<<"|"<<endl; outFile<<"SERVICES-LOWER RATES"<<right<<setw(42)<<"|Balance Forward"<<right<<setw(27)<<"$"<<balance<<" |"<<endl; outFile<<"Please be advised that your meter reading date"<<"|Current Charge"<<endl; outFile<<right<<setw(20)<<"Service Period: "<<right<<setw(27)<<"|"<<endl; outFile<<"was May 5, 2011."<<right<<setw(37)<<"|Water "<<right<<setw(20)<<"$ "<<fixed<<showpoint<<setprecision(2)<<waterbill(chonsw,consw)<<endl; outFile<<right<<setw(50)<<"|Gas"<<right<<setw(23)<<" $ "<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)<<endl;
  • 4. outFile<<right<<setw(55)<<"|Electric"<<right<<setw(18)<<"$ "<<fixed<<showpoint<<setprecision(2)<<electricbill(chargee,conse)<<endl; outFile<<right<<setw(52)<<"|Sewer"<<right<<setw(21)<<"$ "<<fixed<<showpoint<<setprecision(2)<<sewercons<<endl; outFile<<right<<setw(52)<<"|Trash"<<right<<setw(21)<<"$ "<<fixed<<showpoint<<setprecision(2)<<trash<<endl; outFile<<right<<setw(50)<<"|Tax"<<right<<setw(23)<<"$ "<<fixed<<showpoint<<setprecision(2)<<(gasbill(consg)+electricbill(chargee,conse)+waterbi ll(chonsw,consw)+sewercons+trash)*.03<<right<<setw(15)<<endl; outFile<<right<<setw(60)<<"|Miscellaneous"<<right<<setw(13)<<"$ "<<fixed<<showpoint<<setprecision(2)<<misc<<endl; outFile<<right<<setw(68)<<"|Total Current Charges"<<right<<setw(19)<<"$ "<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash)*.03<<endl; outFile<<right<<setw(63)<<"|Gross Amount Due"<<right<<setw(24)<<"$ "<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash)-(previousbalance)*.03<<" |"<<endl; outFile<<right<<setw(61)<<"|Net Amount Due"<<right<<setw(26)<<"$ "<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash)-(previousbalance)*.03<<" |"<<endl; outFile<<setw(60)<<"___"<<endl; outFile<<right<<setw(22)<<"Meter Reading Details"<<right<<setw(28)<<"Degree Days: Past 336"<<right<<setw(14)<<"Present 132"<<endl; outFile<<"________________________________________________________________________ ____________________________________________________"<<endl; outFile<<"|Service"<<right<<setw(10)<<"Meter"<<right<<setw(9)<<"Read"<<right<<setw (13)<<"Previous"<<right<<setw(12)<<"Previous"<<right<<setw(10)<<"Present"<<right<<setw(14 )<<"Present" <<right<<setw(9)<<"No. of"<<right<<setw(9)<<"Monthly"<<right<<setw(32)<<"Billed Usage|"<<endl; outFile<<"|Type"<<right<<setw(13)<<"Number"<<right<<setw(9)<<"Type"<<right<<setw(1 4)<<"Read Date"<<right<<setw(10)<<"Reading"<<right<<setw(13)<<"Read Date"<<right<<setw(12)<<"Reading"<< right<<setw(8)<<"Days"<<right<<setw(9)<<"Usage"<<right<<setw(14)<<"Multiplier"<<ri ght<<setw(19)<<" |"<<endl; outFile<<"|Water"<<right<<setw(12)<<watermeter<<right<<setw(10)<<"Actual"<<right<< setw(6)<<p_st->wMonth-1<<"/"<<p_st->wDay<<"/"<<p_st- >wYear<<right<<setw(10)<<watermeter2<<right<<setw(5)<<p_st->wMonth<<"/"<<p_st- >wDay<<"/"<<p_st- >wYear<<right<<setw(13)<<watermeter3<<right<<setw(7)<<days<<right<<setw(10)<<consw<<right <<setw(26)<<consw<<" GAL|"<<endl; outFile<<"|Gas"<<right<<setw(14)<<gasmeter<<right<<setw(10)<<"Actual"<<right<<setw (6)<<p_st->wMonth-1<<"/"<<p_st->wDay<<"/"<<p_st- >wYear<<right<<setw(10)<<gasmeter2<<right<<setw(5)<<p_st->wMonth<<"/"<<p_st- >wDay<<"/"<<p_st- >wYear<<right<<setw(13)<<gasmeter3<<right<<setw(7)<<days<<right<<setw(10)<<consg<<right<< setw(26)<<consg<<" CUF|"<<endl; outFile<<"|Electric"<<right<<setw(9)<<electric<<right<<setw(10)<<"Actual"<<right<< setw(6)<<p_st->wMonth-1<<"/"<<p_st->wDay<<"/"<<p_st- >wYear<<right<<setw(10)<<electric2<<right<<setw(5)<<p_st->wMonth<<"/"<<p_st- >wDay<<"/"<<p_st- >wYear<<right<<setw(13)<<electric3<<right<<setw(7)<<days<<right<<setw(10)<<conse<<right<< setw(26)<<conse<<" KWH|"<<endl; outFile<<"|Sewer"<<right<<setw(12)<<watermeter<<right<<setw(10)<<"Actual"<<right<< setw(6)<<p_st->wMonth-1<<"/"<<p_st->wDay<<"/"<<p_st-
  • 5. >wYear<<right<<setw(10)<<watermeter2<<right<<setw(5)<<p_st->wMonth<<"/"<<p_st- >wDay<<"/"<<p_st->wYear<<right<<setw(13) <<watermeter3<<right<<setw(7)<<days<<right<<setw(10)<< consw<<right<<setw(26)<<consw<<" GAL|"<<endl; outFile<<"------------------------------------------------------------------------ ----------------------------------------------------"<<endl; outFile<<right<<setw(70)<<"*********************FINAL NOTICE*********************"<<endl; outFile<<"This is to notify you that it may be necessary to discontinue your utility service as of 05/24/11 unless prompt payment of this invoice or"<<endl; outFile<<"satisfactory arrangement for payment is made before this date. Payment in full or satisfactory payment arrangements made before"<<endl; outFile<<"05/24/11 will avoid any reconnection or collection charges. If you have any questions or disputes concerning your account, you should"<<endl; outFile<<"contact us in person, by telephone at (256) 535-1200 or toll free at (866) 478-8845 before 05/24/11. A review procedure is also available"<<endl; outFile<<"to all our customers through which problems or disputes may be resolved; copies are available at the utilities office. Call (256) 535-1200 to"<<endl; outFile<<"make payment agreements by phone. Have your account number and pin number available. No further notice will be provided."<<endl; outFile<<endl; outFile<<right<<setw(35)<<"Please return bottom portion with your payment."<<endl; outFile<<"________________________________________________________________________ ___________________________________________________"<<endl; outFile<<right<<setw(30)<<"Account number "<<account<<right<<setw(30)<<"Pay Gross After"<<right<<setw(17)<<p_st->wMonth<<"/"<<p_st->wDay+10<<"/"<<p_st->wYear<<endl; outFile<<right<<setw(65)<<"Net Amount Due"<<right<<setw(18)<<"$ "<<fixed<<showpoint<<setprecision(2)<<gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash+misc+(gasbill(consg)+electricbill(chargee,conse)+waterbil l(chonsw,consw)+sewercons+trash)-(previousbalance)*.03<<endl; outFile<<endl; outFile<<endl; outFile<<right<<setw(55)<<"_______________________________________"<<endl; outFile<<right<<setw(55)<<"|Total Amount Paid| |"<<endl; outFile<<right<<setw(55)<<"| Project Share| |"<<endl; outFile<<right<<setw(55)<<"---------------------------------------"<<endl; outFile<<right<<setw(55)<<"HUNTSVILLE UTILITIES"<<endl; outFile<<right<<setw(55)<<"HUNTSVILLE, AL 35895"<<endl; outFile<<endl; outFile<<right<<setw(18)<<"UTILITY CUSTOMER"<<endl; outFile<<right<<setw(18)<<"123 ANY STREET"<<endl; outFile<<right<<setw(18)<<"HUNTSVILLE AL 35803"<<endl; outFile<<right<<setw(70)<<"Invoice Number: "<<invnumber<<invnumber2<<endl; outFile<<endl; outFile<<"Charge Details"<<endl; outFile<<"Water-RWM-22/Residential Water HSV ("<<p_st->wMonth-1<<"/"<<p_st- >wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30 days)"<<endl; outFile<<" Availability Charge"<<right<<setw(34)<<avaicharge<<endl; outFile<<" Consumption Charge"<<right<<setw(30)<<"3000 GAL @0.001240"<<right<<setw(8)<<"3.72"<<endl; outFile<<right<<setw(49)<<"3000 GAL @0.001550"<<right<<setw(8)<<"4.65"<<endl; outFile<<right<<setw(49)<<"2900 GAL @0.001680"<<right<<setw(8)<<"4.87"<<right<<setw(9)<<"Total "<<waterbill(chonsw,consw); outFile<<endl; outFile<<"Gas-RGM-22/Residential Gas ("<<p_st->wMonth-1<<"/"<<p_st- >wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30 days)"<<endl;
  • 6. outFile<<" Availability Charge"<<right<<setw(37)<<"4.50"<<endl; outFile<<" Consumption Charge"<<right<<setw(31)<<"800 CUF @0.009700)"<<right<<setw(9)<<consgas<<" Total $"<<gasbill(consg)<<endl; outFile<<endl; outFile<<"Electric-REM-22/Residential Electricity ("<<p_st->wMonth-1<<"/"<<p_st- >wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30 days)"<<endl; outFile<<" Availability Charge"<<right<<setw(38)<<avaichargeelectric<<endl; outFile<<" Consumption Charge"<<right<<setw(29)<<"1400 KWH@0.082720"<<right<<setw(11)<<elecons1<<endl; outFile<<right<<setw(48)<<"667 KWH@0.090730"<<right<<setw(12)<<elecons2<<right<<setw(7)<<"Total $"<<electricbill(chargee,conse)<<endl; outFile<<"________________________________________________________________________ ________"<<endl; outFile<<"Sewer-RSM-22/Residential Sewer ("<<p_st->wMonth-1<<"/"<<p_st- >wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30 days) |"<<endl; outFile<<" Sewer Consumption Charge"<<right<<setw(20)<<"8900 GAL@0.004500"<<right<<setw(11)<<sewercons<<" Total"<<sewercons<<right<<setw(13)<<"|"<<endl; outFile<<right<<setw(81)<<"|"<<endl; outFile<<"Trash-RTU-22/Residential Trash HSV city ("<<p_st->wMonth-1<<"/"<<p_st- >wDay<<"/"<<p_st->wYear<<"-"<<p_st->wMonth<<"/"<<p_st->wDay<<"/"<<p_st->wYear<<", for 30 days)"<<right<<setw(9)<<"|"<<endl; outFile<<" Trash Charge"<<right<<setw(46)<<trash<<" Total $"<<trash<<endl; outFile<<"------------------------------------------------------------------------ ---------"<<endl; outFile<<"Tax"<<right<<setw(60)<<(gasbill(consg)+electricbill(chargee,conse)+water bill(chonsw,consw)+sewercons+trash)*.03<<" Total $"<<(gasbill(consg)+electricbill(chargee,conse)+waterbill(chonsw,consw)+sewercons+trash)* .03<<endl; outFile<<endl; outFile<<endl; outFile<<endl; outFile<<endl; outFile<<endl; outFile<<endl; outFile<<endl; outFile<<endl; outFile<<"Huntsville Utilities"<<right<<setw(40)<<"Telephone Numbers"<<endl; outFile<<"TO REPORT AN OUTAGE-(256)53-LIGHT 535- 4448"<<right<<setw(25)<<"Huntsville City Garbage-(256) 883-3964"<<endl; outFile<<"FOR ALL OTHER CUSTOMER INQUIRIES (256) 535-1200/Toll Free 866-478- 8845"<<" Huntsville City Sewer-(256) 883-3719"<<endl; outFile<<"Have account number and pin number available"<<right<<setw(25)<<"Madison County Garbage-(256) 532-3718"<<endl; outFile<<"PAYMENT BY CREDIT CARD/SPEEDPAY 1-877-429- 4131"<<right<<setw(25)<<"Madison County Water-(256) 746-2888"<<endl; outFile<<right<<setw(45)<<"City of New Hope-(256) 723-2616"<<endl; outFile<<"________________________________________________________________________ ________"<<endl; outFile<<endl; } return 0; }
  • 7. double gasbill(double consg) { double bill; if(consg>4000) bill=0.090739*consg; else bill=0.08272*consg; return bill; } double electricbill(double chargee,double conse) { double electric; if(conse>4000) electric=0.09073*conse+chargee; else electric=0.08272*conse+chargee; return electric; } double waterbill(double chonsw,double consw) { if(consw>4000) chonsw=0.00168*consw; else if(consw>3000) chonsw=0.00155*consw; else chonsw=0.00168*consw; return chonsw; }