Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class bill
- {
- private:
- float finalBill;
- // void calFinalbill();
- public:
- int billNo, units;
- float uPrice, rate,amount, disAmt;
- // void getInputs();
- // void calAmount();
- // void caldiscountAmt();
- // void displayFinelbill();
- void getInputs()
- {
- cout<<"Enter bill number-";
- cin>>billNo;
- cout<<"Enter amount of used units-";
- cin>>units;
- cout<<"Enter amount of unit price-";
- cin>>uPrice;
- }
- void calAmount()
- {
- amount=units*uPrice;
- }
- void caldiscountAmt()
- {
- if(units>100||units<199)
- {
- disAmt=amount*0.02;
- }
- else {
- disAmt=amount*0.06;
- }
- }
- void displayFinalbill()
- {
- cout<<"Bill number-"<<billNo<<endl;
- cout<<"Finel bill amount -"<<calFinalbill()<<endl;
- }
- float calFinalbill()
- {
- return (amount-disAmt);
- }
- };
- int main()
- {
- bill obj1;
- obj1.getInputs();
- obj1.calAmount();
- obj1.caldiscountAmt();
- obj1.displayFinalbill();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement