#include<iostream>
#include<string.h>
using namespace std;
class E_bill {
public:
int cust_no;
string name;
int st_reading;
int end_reading;
int tot_usage;
int amount;
E_bill(int x, string y, int s,int e, int z,int a) { // Constructor with parameters
cust_no = x;
name = y;
st_reading = s;
end_reading = e;
tot_usage = z;
amount = a;
}
~E_bill(){//destructor
}
};
int main() {
E_bill cust1(1,"John",1,5,1500,1000);
E_bill cust2(2,"Grace",3,5,1000,1000);
cout<<"Number\t"<<"Name\t"<<"Start\t"<<"End\t"<<"usage\t"<<"Amount\t"<<endl;
cout << cust1.cust_no << "\t" << cust1.name<< "\t" << cust1.st_reading<<"\t"<<cust1.end_reading<<"\t"<<cust1.tot_usage<<"\t"<<cust1.amount << "\n";
cout << cust2.cust_no << "\t" << cust2.name << "\t" << cust2.st_reading<<"\t"<<cust2.end_reading<<"\t"<<cust2.tot_usage<<"\t"<<cust2.amount << "\n";
int v=cust1.amount+cust2.amount;
int r=cust1.amount*5.50+cust2.amount*5.50;
cout<<"Total energy usage is: "<<v;
cout<<"\nAmount per unit of electric energy: "<<r;
return 0;
}
Comments
Leave a comment