You are on page 1of 2

#include<conio.

h>
#include<iostream>
#include<string>
using namespace std;
class Bags
{
private:
int noofbags;
float costoforder;
public:
Bags()
{
noofbags=0;
costoforder=0;
}
Bags(float n,float c,float tc)
{
noofbags=n;
costoforder=c;
}
void input()
{
cout<<"Enter number of you wanted to order"<<endl;
cin>>noofbags;
}
void Cost_Order()
{
costoforder=(noofbags*5.50);
cout<<endl<<"The cost of order is: "<<costoforder<<endl;
}
void Box_Used()
{
float LB,lb,MB,mb,sb;
int SB;
LB=(noofbags)/20;
lb=(LB*1.80);
cout<<endl<<LB<<" Large Boxes : "<<lb<<endl;
MB=(noofbags)%20;
MB=int(MB/10);
mb=((MB*1.00));
cout<<MB<<" Medium Boxes : "<<mb;
SB=(noofbags-(LB*20)-(MB*10));
SB=int (SB/5);
sb=(SB*0.60);
cout<<endl<<SB<<" Small Boxes : "<<sb;
cout<<endl<<"Your Total Cost is: "<<(noofbags*5.50)+lb+mb+sb;
}
void display()
{
cout<<endl<<"No of bags ordered :"<<noofbags;
}
};
int main()
{
Bags b1;
b1.input();
b1.display();
b1.Cost_Order();
b1.Box_Used();
getche();
return(0);
}

OUTPUT:

You might also like