Tuesday, 31 July 2018

Electricity Billing

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
clrscr();
int nac,ntube,nfan,ntv,n;
float TE,RS,E,ac,fan,tube,tv,p1=0,p2=0,p3=0;
char name[20];
cout<<"Electricity BILL:- \n Enter your Name: ";
cin>>name;
cout<<"\n  Enter Number of AC: ";
cin>>nac;
cout<<"\n        ¯Enter power of one AC(in Watt): ";
cin>>ac;
cout<<"\n  Enter Number of Tubelight: ";
cin>>ntube;
cout<<"\n        ¯Enter power of one Tubelight(in Watt): ";
cin>>tube;
cout<<"\n  Enter Number of Fan: ";
cin>>nfan;
cout<<"\n        ¯Enter power of one Fan(in Watt): ";
cin>>tube;
cout<<"\n  Enter Number of T.V.: ";
cin>>ntv;
cout<<"\n        ¯Enter power of one TV(in Watt): ";
cin>>tv;
cout<<"\n\nEnter number of days: ";
cin>>n;
E=(ac*nac+tube*ntube+fan*ntube)/1000.0;
TE=n*E;
if(TE>0 && TE<=200)
{
p1=2.80*TE;
}
else if(TE>200 && TE<=400)
{
p1=2.80*200;
p2=3.40*(TE-200);
}
else
{
p1=2.80*200;
p2=3.40*200;
p3=5*(TE-400);
}

cout<<"\n"<<name<<" You have to pay "<<p1+p2+p3;
getch();
}



===========================================================================


                                OUTPUT



No comments:

Post a Comment