Program for finding your electricity or gas bill with standard extra charges.
Program
A program is set of instruction given by user to computer to perform a specific task.computer program, in depth intend or else process in lieu of solving a riddle by means of a computer; supplementary specifically, an unambiguous, well thought-out string of computational advice indispensable near attain such a solution.
Program Body
#include<iostream>
#include <string>
#include<math.h>
using namespace std;
class ebill{
private:
float bill,punits,newu,un,up;
public:
void caluclation();
};
void ebill::caluclation(){
cout<<"Please Enter the units of last month"<<endl;
cin>>punits;
cout<<"Please Enter the current units"<<endl;
cin>>newu;
cout<<"Please Enter the price of units in your country"<<endl;
cin>>up;
un=newu-punits;
if(un<300){
bill=up*un;
cout<<"your total bill is "<<bill<<endl;
}
else if(un>300){
bill=(up*un*5)/100;
cout<<"your total bill is "<<bill<<endl;
}
else {
cout<<"There is problem with your units please recheck them."<<endl;
}
}
int main(){
ebill obj;
obj.caluclation();
}