Monday, July 27, 2020

CS101 Assignment No.3 Solution Spring 2020 with Complete Explanation







Solution Code here



==============

#include<iostream>

using namespace std;

main()

{

int choice;

int quantity;

int price=0;

int bill=0;

char option;







cout<<"Fast Food Resturant Menu" <<endl;

cout<<"Enter 1 for Pizza (Rs. 999)" <<endl;

cout<<"Enter 2 for Burger (Rs. 250)" <<endl;

cout<<"Enter 3 for Sandwich (Rs. 150)" <<endl;

cout<<"Enter 4 for Paratha Roll (Rs. 200)" <<endl;





do

{

cout<<"Enter Your Choice according to menu : " <<endl;

cin>>choice;

cout<<"Enter quantity of selected : " <<endl;

cin>>quantity;



if(choice==1)

{

price = quantity * 999;

}

else if(choice==2)

{

price = quantity * 250;

}

else if(choice==3)

{

price = quantity * 150;

}

else if(choice==4)

{

price = quantity * 200;

}

else

{

cout<<"Invalid choice Please Try Again";

}





bill = bill + price;

cout<<"Do you want to select anyother item ? (y for Yes) : " <<endl;

cin>>option;





}while(option=='y' || option == 'Y');







float gst = (float) bill*19/100;

float total = bill + gst;

float discount=0;





if(total>1000)

{

discount=total*5/100;

total=total-discount;

}





cout<<"Price of Items : "<<bill <<endl;

cout<<"Amount of GST : "<<gst <<endl;

cout<<"Discount : "<<discount <<endl;

cout<<"Payable Amount : "<<total <<endl;

}



========================

No comments:

Post a Comment