Академический Документы
Профессиональный Документы
Культура Документы
#include <stdlib.h>
#include <iostream.h>
class KFC{
public:
KFC(){}
KFC(int pQty, int zQty, int fQty)
{
pepsiQty=pQty;
zingerQty=zQty;
friesQty=fQty;
}
int pepsiBill()
{
return pepsiQty*15;
}
int zingerBill()
{
return zingerQty*20;
}
int friesBill()
{
return friesQty*30;
}
void billWithGrandTotal()
{
cout<<"\n\n\nItem\tQty\tPrice\n";
cout<<"\nPepsi\t "<<pepsiQty<<"\t "<<pepsiQty*15;
cout<<"\nZinger\t "<<zingerQty<<"\t "<<zingerQty*20;
cout<<"\nFries\t "<<friesQty<<"\t "<<friesQty*30;
cout<<"\n=====================";
cout<<"\nGrand Total = "<<pepsiBill()+zingerBill()
+friesBill();
cout<<"\n=====================\n";
private:
int pepsiQty;
int zingerQty;
int friesQty;
};
void main()
{
KFC kfc[5];
int pQ,zQ,fQ;
for(int i=0;i<5;i++)
{
system("cls");
cout<<"\nEnter the Qty of Pepsi for Customer "<<i+1<<": ";
cin>>pQ;
kfc[i].setPepsiQty(pQ);
cout<<"\nEnter the Qty of Zinger for Customer "<<i+1<<": ";
cin>>zQ;
kfc[i].setZingerQty(zQ);
cout<<"\nEnter the Qty of Fries for Customer "<<i+1<<": ";
cin>>fQ;
kfc[i].setFriesQty(fQ);
}
system("cls");
for(int m=0;m<5;m++)
{
cout<<"\n\nBill of Person "<<m+1<<" is\n";
kfc[m].billWithGrandTotal();
}
for(int j=0;j<5-1;j++)
for(int k=0;k<5-1;k++){
if(kfc[k].getGrandTotal()<kfc[k+1].getGrandTotal())
{
KFC temp;
temp=kfc[k];
kfc[k]=kfc[k+1];
kfc[k+1]=temp;
}
}
cout<<endl<<endl;
URL: http://ravianeducation.blogspot.com
E-Mail: mail2ravian@gmail.com
Farhan: 03008855006