Q. Make a KFC program that calculate the bill of five customers and print the bill of top three customers. #include <stdlib.h> #include
class KFC{ public: KFC(){} KFC(int pQty, int zQty, int fQty) { pepsiQty=pQty; zingerQty=zQty; friesQty=fQty; } void setPepsiQty(int pQty){pepsiQty=pQty;} void setZingerQty(int zQty){zingerQty=zQty;} void setFriesQty(int fQty){friesQty=fQty;} int getPepsiQty(){return pepsiQty;} int getZingerQty(){return zingerQty;} int getFriesQty(){return friesQty;} 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 "<
cout<<"\nGrand Total = "<>pQ; kfc[i].setPepsiQty(pQ); cout<<"\nEnter the Qty of Zinger for Customer "<>zQ; kfc[i].setZingerQty(zQ); cout<<"\nEnter the Qty of Fries for Customer "<>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]=kfc[k+1]; kfc[k+1]=temp; }
}
cout<<"\n\nTop 3 Customers are \n\n"; for(int l=0;l<3;l++) cout<<"Total Bill "<
Click the link below to see more examples URL: http://ravianeducation.blogspot.com E-Mail: [email protected] Farhan: 03008855006