Program for finding your electricity or gas bill with standard extra charges.

in #programming7 years ago

 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();
}

Written in C++

Source

Made in Visual C++ IDE

Source

 I hope it was helpful and you learned something from it, Thanks

Coin Marketplace

STEEM 0.21
TRX 0.25
JST 0.038
BTC 97111.20
ETH 3382.29
USDT 1.00
SBD 3.20