Programming Fundamentals Assignment No 01

Here is the Programming Fundamentals Assignment No 01

Question:

This assignment demonstrates the food ordering system. You need to develop a self-service menu-based food ordering application that customers can use to order different food items. The program when executed should display various food items in the form of a menu such as given as follows:

Next, the system should prompt to the customer “What food item you would like to order?”. After specifying the food item, next it should prompt about the quantity of that item. Finally, it should ask the customer about the name, contact number and address that are required for billing purposes. After taking the order from customer, the system should display the aforementioned menu once again with updated stocks and generate a bill such as given as follows:

Note – Every single literal/value (whether it is a numeric number or string literal) being printed on screen must be assigned to the respective variable. Direct printing of values would not be considered.

Applying the concepts of selection structures, setw() and setprecision( ) manipulators, solve the given computing problem.

Code:

Here is the Programming Fundamentals Assignment No 01

#include<iostream>

using namespace std;

int main()
{
int item_no,b,sitem_1=23,sitem_2=10,sitem_3=8,sitem_4=44,sitem_5=7,vat=30,sitem_6=46,sitem_7=34,remaining; // ASSIGNING VARIABLES.
double p,b1;
float pitem_1=120.23,pitem_2=100.67,pitem_3=720.83,pitem_4=70.23,pitem_5=520.29,pitem_6=70.23,pitem_7=60.23,subtotal,totalprice; // ASSIGNING VARIABLES.
string item_1="BURGER",item_2="PIZZA",item_3="HOT CAKE",item_4="COFFIE",item_5="GRILL",item_6="ICE CREAM",item_7="SANDWICH",customername,address,contact; // ASSIGNING VARIABLES.

   //DISPLAYING THE MENU TO THE USER

    cout<<"\n\n\n\t\t\tFOOD MENU";

    cout<<left;
    cout<<"\n----------------------------------------------------";


    cout<<"\n|"<<setw(5)<<"S No."<<setw(5)<<"|"<<setw(10)<<"Name"<<setw(5)<<"|"<<setw(10)<<"Price"<<setw(5)<<"|"<<setw(10)<<"In Stock"<<setw(5)<<"|";
    cout<<"\n----------------------------------------------------";

    cout<<"\n|"<<setw(5)<<"1"<<setw(5)<<"|"<<setw(10)<<item_1<<setw(5)<<"|"<<setw(10)<<pitem_1<<setw(5)<<"|"<<setw(10)<<sitem_1<<setw(5)<<"|";
    cout<<"\n----------------------------------------------------";

    cout<<"\n|"<<setw(5)<<"2"<<setw(5)<<"|"<<setw(10)<<item_2<<setw(5)<<"|"<<setw(10)<<pitem_2<<setw(5)<<"|"<<setw(10)<<sitem_2<<setw(5)<<"|";
    cout<<"\n----------------------------------------------------";

    cout<<"\n|"<<setw(5)<<"3"<<setw(5)<<"|"<<setw(10)<<item_3<<setw(5)<<"|"<<setw(10)<<pitem_3<<setw(5)<<"|"<<setw(10)<<sitem_3<<setw(5)<<"|";
    cout<<"\n----------------------------------------------------";

    cout<<"\n|"<<setw(5)<<"4"<<setw(5)<<"|"<<setw(10)<<item_4<<setw(5)<<"|"<<setw(10)<<pitem_4<<setw(5)<<"|"<<setw(10)<<sitem_4<<setw(5)<<"|";
    cout<<"\n----------------------------------------------------";

    cout<<"\n|"<<setw(5)<<"5"<<setw(5)<<"|"<<setw(10)<<item_5<<setw(5)<<"|"<<setw(10)<<pitem_5<<setw(5)<<"|"<<setw(10)<<sitem_5<<setw(5)<<"|";
    cout<<"\n----------------------------------------------------";

    cout<<"\n|"<<setw(5)<<"6"<<setw(5)<<"|"<<setw(10)<<item_6<<setw(5)<<"|"<<setw(10)<<pitem_6<<setw(5)<<"|"<<setw(10)<<sitem_6<<setw(5)<<"|";
    cout<<"\n----------------------------------------------------";

    cout<<"\n|"<<setw(5)<<"7"<<setw(5)<<"|"<<setw(10)<<item_7<<setw(5)<<"|"<<setw(10)<<pitem_7<<setw(5)<<"|"<<setw(10)<<sitem_7<<setw(5)<<"|";
    cout<<"\n----------------------------------------------------";

    //ASKING CUSTOMER FOR DETAILS

        cout<<setprecision(3);
        cout<<fixed;
        cout<<"\n\n------------CUSTOMER DETAILS--------------";
        cout<<"\n\nENTER THE CUSTOMER NAME: ";
        getline(cin,customername);
        cout<<"\nENTER YOUR ADDRESS:  " ;
        getline(cin,address);
        cout<<"\nENTER YOUR CONTACT NO: ";
        cin>>contact;


        cout<<"\n\nENTER THE FOOD YOU WANT TO ORDER: ";
        cin>>item_no;



        if (item_no<=0 || item_no>7)

        cout<<"\n\nYOU HAVE ENTERED INVALID FOOD ITEM NO\nTHANKS FOR USING OUR SERVICE";


        // INPUT FOR ITEM NO 01 BY THE USER


                if (item_no==1 )


{

                    cout<<"\nHOW MANY BURGERS DO YOU WANT: ";        // ASKING THE USER FOR INPUT
                    cin>>b;


                    if (b<=0 )
                    cout<<"\nINVALID INPUT\nTHANKS FOR USING OUR SERVICE";

                    else if(b>sitem_1)
                    cout<<"\n\nTHE STOCK IS LESS THAN YOU ORDERED.\nTHANKS FOR USING OUR SERVICE";      // IF STOCK IS LESS THIS MESSAGE WILL BE DISPLAYED


                    if (b>0 && b<=23 )
            {
                    cout<<"\n\n---------------------ORDER SUMMARY------------------------"<<endl<<endl;             // MAKING RECIPT OF THE FOOD SELECTED
                    cout<<"ITEM ORDERED\t\tQUANTITY\t\tUNIT PRICE"<<endl;
                    cout<<"\n----------------------------------------------------------"<<endl;
                    cout<<item_1<<"\t\t\t"<<b<<"\t\t\t"<<pitem_1;                               //DISPLAYING THE RECIPT
                    cout<<"\n\n\n----------------------------------------------------------";
                    subtotal=pitem_1*b;                                        
                    totalprice=subtotal+vat;
                    cout<<"\nSUBTOTAL       :"<<subtotal;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nVAT            :"<<vat;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nTOTAL PRICE    :"<<totalprice;
                    cout<<"\n----------------------------------------------------------";

                    cout<<"\n\n---------------------BILLING DETAILS---------------------";              // PRINTING BILLING DETAILS

                    cout<<"\n\nCUSTOMER NAME         :"<<customername;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nCONTACT NO            :"<<contact;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nADDRESS               :"<<address;
                    cout<<"\n----------------------------------------------------------";

                    // DISPLAYING THE MENU WITH UPDATED FOOD STOCK

                    cout<<"\n\n\n\n\t\t\tFOOD MENU";
                    cout<<"\n----------------------------------------------------"; 
                    cout<<"\n|"<<setw(5)<<"S No."<<setw(5)<<"|"<<setw(10)<<"Name"<<setw(5)<<"|"<<setw(10)<<"Price"<<setw(5)<<"|"<<setw(10)<<"In Stock"<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"1"<<setw(5)<<"|"<<setw(10)<<item_1<<setw(5)<<"|"<<setw(10)<<pitem_1<<setw(5)<<"|"<<setw(10)<<sitem_1-b<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"2"<<setw(5)<<"|"<<setw(10)<<item_2<<setw(5)<<"|"<<setw(10)<<pitem_2<<setw(5)<<"|"<<setw(10)<<sitem_2<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"3"<<setw(5)<<"|"<<setw(10)<<item_3<<setw(5)<<"|"<<setw(10)<<pitem_3<<setw(5)<<"|"<<setw(10)<<sitem_3<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"4"<<setw(5)<<"|"<<setw(10)<<item_4<<setw(5)<<"|"<<setw(10)<<pitem_4<<setw(5)<<"|"<<setw(10)<<sitem_4<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"5"<<setw(5)<<"|"<<setw(10)<<item_5<<setw(5)<<"|"<<setw(10)<<pitem_5<<setw(5)<<"|"<<setw(10)<<sitem_5<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"6"<<setw(5)<<"|"<<setw(10)<<item_6<<setw(5)<<"|"<<setw(10)<<pitem_6<<setw(5)<<"|"<<setw(10)<<sitem_6<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"7"<<setw(5)<<"|"<<setw(10)<<item_7<<setw(5)<<"|"<<setw(10)<<pitem_7<<setw(5)<<"|"<<setw(10)<<sitem_7<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

            }   




    }

                    // INPUT FOR ITEM NO 02

                    if (item_no==2 )

    {
                    cout<<"\nHOW MANY PIZZA DO YOU WANT: ";              // ASKING THE USER FOR INPUT
                    cin>>b;

                    if (b<=0 )
                    cout<<"\nINVALID INPUT\nTHANKS FOR USING OUR SERVICE";

                    else if(b>sitem_2)
                    cout<<"\n\nTHE STOCK IS LESS THAN YOU ORDERED.\nTHANKS FOR USING OUR SERVICE";        // IF STOCK IS LESS THIS MESSAGE WILL BE DISPLAYED


                    if (b>0 && b<=10 )
            {
                    cout<<"\n--------------------ORDER SUMMARY---------------------------"<<endl<<endl;
                    cout<<"ITEM ORDERED\t\tQUANTITY\t\tUNIT PRICE"<<endl;                              // MAKING RECIPT OF THE FOOD SELECTED
                    cout<<"\n----------------------------------------------------------"<<endl;
                    cout<<item_2<<"\t\t\t"<<b<<"\t\t\t"<<pitem_2;                                 //DISPLAYING THE RECIPT
                    cout<<"\n\n\n----------------------------------------------------------";
                    subtotal=pitem_2*b;
                    totalprice=subtotal+vat;
                    cout<<"\nSUBTOTAL       :"<<subtotal;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nVAT            :"<<vat;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nTOTAL PRICE    :"<<totalprice;
                    cout<<"\n----------------------------------------------------------";

                    cout<<"\n\n---------------------BILLING DETAILS--------------------";           // PRINTING BILLING DETAILS

                    cout<<"\n\nCUSTOMER NAME         :"<<customername;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nCONTACT NO            :"<<contact;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nADDRESS               :"<<address;
                    cout<<"\n----------------------------------------------------------";

                    // DISPLAYING THE MENU WITH UPDATED FOOD STOCK

                    cout<<"\n\n\n\n\t\t\tFOOD MENU";
                    cout<<"\n----------------------------------------------------"; 
                    cout<<"\n|"<<setw(5)<<"S No."<<setw(5)<<"|"<<setw(10)<<"Name"<<setw(5)<<"|"<<setw(10)<<"Price"<<setw(5)<<"|"<<setw(10)<<"In Stock"<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"1"<<setw(5)<<"|"<<setw(10)<<item_1<<setw(5)<<"|"<<setw(10)<<pitem_1<<setw(5)<<"|"<<setw(10)<<sitem_1<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"2"<<setw(5)<<"|"<<setw(10)<<item_2<<setw(5)<<"|"<<setw(10)<<pitem_2<<setw(5)<<"|"<<setw(10)<<sitem_2-b<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"3"<<setw(5)<<"|"<<setw(10)<<item_3<<setw(5)<<"|"<<setw(10)<<pitem_3<<setw(5)<<"|"<<setw(10)<<sitem_3<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"4"<<setw(5)<<"|"<<setw(10)<<item_4<<setw(5)<<"|"<<setw(10)<<pitem_4<<setw(5)<<"|"<<setw(10)<<sitem_4<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"5"<<setw(5)<<"|"<<setw(10)<<item_5<<setw(5)<<"|"<<setw(10)<<pitem_5<<setw(5)<<"|"<<setw(10)<<sitem_5<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"6"<<setw(5)<<"|"<<setw(10)<<item_6<<setw(5)<<"|"<<setw(10)<<pitem_6<<setw(5)<<"|"<<setw(10)<<sitem_6<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"7"<<setw(5)<<"|"<<setw(10)<<item_7<<setw(5)<<"|"<<setw(10)<<pitem_7<<setw(5)<<"|"<<setw(10)<<sitem_7<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 


            }   


    }

                    // INPUT FOR ITEM NO 03

                    if (item_no==3 )

    {
                    cout<<"HOW MANY HOT CAKE DO YOU WANT: ";
                    cin>>b;

                    if (b<=0 )
                    cout<<"\nINVALID INPUT\nTHANKS FOR USING OUR SERVICE";

                    else if(b>sitem_3)
                    cout<<"\n\nTHE STOCK IS LESS THAN YOU ORDERED.\nTHANKS FOR USING OUR SERVICE";     // IF STOCK IS LESS THIS MESSAGE WILL BE DISPLAYED


                    if (b>0 && b<=8 )
            {
                    cout<<"\n--------------------ORDER SUMMARY---------------------------"<<endl<<endl;
                    cout<<"ITEM ORDERED\t\tQUANTITY\t\tUNIT PRICE"<<endl;                        // MAKING RECIPT OF THE FOOD SELECTED
                    cout<<"\n----------------------------------------------------------"<<endl;
                    cout<<item_3<<"\t\t"<<b<<"\t\t\t"<<pitem_3;                                      //DISPLAYING THE RECIPT
                    cout<<"\n\n\n----------------------------------------------------------";
                    subtotal=pitem_3*b;
                    totalprice=subtotal+vat;
                    cout<<"\nSUBTOTAL       :"<<subtotal;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nVAT            :"<<vat;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nTOTAL PRICE    :"<<totalprice;
                    cout<<"\n----------------------------------------------------------";

                    cout<<"\n\n----------------------BILLING DETAILS-------------------";           // PRINTING BILLING DETAILS

                    cout<<"\n\nCUSTOMER NAME         :"<<customername;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nCONTACT NO            :"<<contact;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nADDRESS               :"<<address;
                    cout<<"\n----------------------------------------------------------";

                    // DISPLAYING THE MENU WITH UPDATED FOOD STOCK

                    cout<<"\n\n\n\n\t\t\tFOOD MENU";
                    cout<<"\n----------------------------------------------------"; 
                    cout<<"\n|"<<setw(5)<<"S No."<<setw(5)<<"|"<<setw(10)<<"Name"<<setw(5)<<"|"<<setw(10)<<"Price"<<setw(5)<<"|"<<setw(10)<<"In Stock"<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"1"<<setw(5)<<"|"<<setw(10)<<item_1<<setw(5)<<"|"<<setw(10)<<pitem_1<<setw(5)<<"|"<<setw(10)<<sitem_1<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"2"<<setw(5)<<"|"<<setw(10)<<item_2<<setw(5)<<"|"<<setw(10)<<pitem_2<<setw(5)<<"|"<<setw(10)<<sitem_2<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"3"<<setw(5)<<"|"<<setw(10)<<item_3<<setw(5)<<"|"<<setw(10)<<pitem_3<<setw(5)<<"|"<<setw(10)<<sitem_3-b<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"4"<<setw(5)<<"|"<<setw(10)<<item_4<<setw(5)<<"|"<<setw(10)<<pitem_4<<setw(5)<<"|"<<setw(10)<<sitem_4<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"5"<<setw(5)<<"|"<<setw(10)<<item_5<<setw(5)<<"|"<<setw(10)<<pitem_5<<setw(5)<<"|"<<setw(10)<<sitem_5<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"6"<<setw(5)<<"|"<<setw(10)<<item_6<<setw(5)<<"|"<<setw(10)<<pitem_6<<setw(5)<<"|"<<setw(10)<<sitem_6<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"7"<<setw(5)<<"|"<<setw(10)<<item_7<<setw(5)<<"|"<<setw(10)<<pitem_7<<setw(5)<<"|"<<setw(10)<<sitem_7<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 


            }   



    }


                    // INPUT FOR ITEM NO 04

                    if (item_no==4 )

    {
                    cout<<"\nHOW MANY COFFIE DO YOU WANT: ";
                    cin>>b;

                    if (b<=0 )
                    cout<<"\nINVALID INPUT\nTHANKS FOR USING OUR SERVICE";

                    else if(b>sitem_4)
                    cout<<"\n\nTHE STOCK IS LESS THAN YOU ORDERED.\nTHANKS FOR USING OUR SERVICE";        // IF STOCK IS LESS THIS MESSAGE WILL BE DISPLAYED

                    if (b>0 && b<=44 )

            {

                    cout<<"\n------------------ORDER SUMMARY-----------------------------"<<endl<<endl;
                    cout<<"ITEM ORDERED\t\tQUANTITY\t\tUNIT PRICE"<<endl;                        // MAKING RECIPT OF THE FOOD SELECTED
                    cout<<"\n----------------------------------------------------------"<<endl;
                    cout<<item_4<<"\t\t\t"<<b<<"\t\t\t"<<pitem_4;                              //DISPLAYING THE RECIPT
                    cout<<"\n\n\n----------------------------------------------------------";
                    subtotal=pitem_4*b;
                    totalprice=subtotal+vat;
                    cout<<"\nSUBTOTAL       :"<<subtotal;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nVAT            :"<<vat;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nTOTAL PRICE    :"<<totalprice;
                    cout<<"\n----------------------------------------------------------";

                    cout<<"\n\n-------------------BILLING DETAILS----------------------";           // PRINTING BILLING DETAILS

                    cout<<"\n\nCUSTOMER NAME         :"<<customername;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nCONTACT NO            :"<<contact;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nADDRESS               :"<<address;
                    cout<<"\n----------------------------------------------------------";

                    // DISPLAYING THE MENU WITH UPDATED FOOD STOCK

                    cout<<"\n\n\n\n\t\t\tFOOD MENU";
                    cout<<"\n----------------------------------------------------"; 
                    cout<<"\n|"<<setw(5)<<"S No."<<setw(5)<<"|"<<setw(10)<<"Name"<<setw(5)<<"|"<<setw(10)<<"Price"<<setw(5)<<"|"<<setw(10)<<"In Stock"<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"1"<<setw(5)<<"|"<<setw(10)<<item_1<<setw(5)<<"|"<<setw(10)<<pitem_1<<setw(5)<<"|"<<setw(10)<<sitem_1<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"2"<<setw(5)<<"|"<<setw(10)<<item_2<<setw(5)<<"|"<<setw(10)<<pitem_2<<setw(5)<<"|"<<setw(10)<<sitem_2<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"3"<<setw(5)<<"|"<<setw(10)<<item_3<<setw(5)<<"|"<<setw(10)<<pitem_3<<setw(5)<<"|"<<setw(10)<<sitem_3<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"4"<<setw(5)<<"|"<<setw(10)<<item_4<<setw(5)<<"|"<<setw(10)<<pitem_4<<setw(5)<<"|"<<setw(10)<<sitem_4-b<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"5"<<setw(5)<<"|"<<setw(10)<<item_5<<setw(5)<<"|"<<setw(10)<<pitem_5<<setw(5)<<"|"<<setw(10)<<sitem_5<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"6"<<setw(5)<<"|"<<setw(10)<<item_6<<setw(5)<<"|"<<setw(10)<<pitem_6<<setw(5)<<"|"<<setw(10)<<sitem_6<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"7"<<setw(5)<<"|"<<setw(10)<<item_7<<setw(5)<<"|"<<setw(10)<<pitem_7<<setw(5)<<"|"<<setw(10)<<sitem_7<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 


            }   




       }

                    // INPUT FOR ITEM NO 05

                    if (item_no==5 )

{
                    cout<<"\nHOW MANY GRILL DO YOU WANT: ";
                    cin>>b;

                    if (b<=0 )
                    cout<<"\nINVALID INPUT\nTHANKS FOR USING OUR SERVICE";

                    else if(b>7)
                    cout<<"\n\nTHE STOCK IS LESS THAN YOU ORDERED.\nTHANKS FOR USING OUR SERVICE";      // IF STOCK IS LESS THIS MESSAGE WILL BE DISPLAYED



                    if (b>0 && b<=7 )
            {

                    cout<<"\n-------------------ORDER SUMMARY----------------------------"<<endl<<endl;
                    cout<<"ITEM ORDERED\t\tQUANTITY\t\tUNIT PRICE"<<endl;                               // MAKING RECIPT OF THE FOOD SELECTED
                    cout<<"\n----------------------------------------------------------"<<endl;
                    cout<<item_5<<"\t\t\t"<<b<<"\t\t\t"<<pitem_5;                            //DISPLAYING THE RECIPT
                    cout<<"\n\n\n----------------------------------------------------------";
                    subtotal=pitem_5*b;
                    totalprice=subtotal+vat;
                    cout<<"\nSUBTOTAL       :"<<subtotal;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nVAT            :"<<vat;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nTOTAL PRICE    :"<<totalprice;
                    cout<<"\n----------------------------------------------------------";

                    cout<<"\n\n---------------------BILLING DETAILS--------------------";           // PRINTING BILLING DETAILS

                    cout<<"\n\nCUSTOMER NAME         :"<<customername;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nCONTACT NO            :"<<contact;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nADDRESS               :"<<address;
                    cout<<"\n----------------------------------------------------------";

                    // DISPLAYING THE MENU WITH UPDATED FOOD STOCK

                    cout<<"\n\n\n\n\t\t\tFOOD MENU";
                    cout<<"\n----------------------------------------------------"; 
                    cout<<"\n|"<<setw(5)<<"S No."<<setw(5)<<"|"<<setw(10)<<"Name"<<setw(5)<<"|"<<setw(10)<<"Price"<<setw(5)<<"|"<<setw(10)<<"In Stock"<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"1"<<setw(5)<<"|"<<setw(10)<<item_1<<setw(5)<<"|"<<setw(10)<<pitem_1<<setw(5)<<"|"<<setw(10)<<sitem_1<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"2"<<setw(5)<<"|"<<setw(10)<<item_2<<setw(5)<<"|"<<setw(10)<<pitem_2<<setw(5)<<"|"<<setw(10)<<sitem_2<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"3"<<setw(5)<<"|"<<setw(10)<<item_3<<setw(5)<<"|"<<setw(10)<<pitem_3<<setw(5)<<"|"<<setw(10)<<sitem_3<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"4"<<setw(5)<<"|"<<setw(10)<<item_4<<setw(5)<<"|"<<setw(10)<<pitem_4<<setw(5)<<"|"<<setw(10)<<sitem_4<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"5"<<setw(5)<<"|"<<setw(10)<<item_5<<setw(5)<<"|"<<setw(10)<<pitem_5<<setw(5)<<"|"<<setw(10)<<sitem_5-b<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"6"<<setw(5)<<"|"<<setw(10)<<item_6<<setw(5)<<"|"<<setw(10)<<pitem_6<<setw(5)<<"|"<<setw(10)<<sitem_6<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"7"<<setw(5)<<"|"<<setw(10)<<item_7<<setw(5)<<"|"<<setw(10)<<pitem_7<<setw(5)<<"|"<<setw(10)<<sitem_7<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 



            }


}   

                // INPUT FOR ITEM NO 06 BY THE USER


                if (item_no==6 )


{

                    cout<<"\nHOW MANY ICE CREAM DO YOU WANT: ";        // ASKING THE USER FOR INPUT
                    cin>>b;


                    if (b<=0 )
                    cout<<"\nINVALID INPUT\nTHANKS FOR USING OUR SERVICE";

                    else if(b>sitem_6)
                    cout<<"\n\nTHE STOCK IS LESS THAN YOU ORDERED.\nTHANKS FOR USING OUR SERVICE";      // IF STOCK IS LESS THIS MESSAGE WILL BE DISPLAYED


                    if (b>0 && b<=46 )
            {
                    cout<<"\n----------------------ORDER SUMMARY-----------------------"<<endl<<endl;               // MAKING RECIPT OF THE FOOD SELECTED
                    cout<<"ITEM ORDERED\t\tQUANTITY\t\tUNIT PRICE"<<endl;
                    cout<<"\n----------------------------------------------------------"<<endl;
                    cout<<item_6<<"\t\t"<<b<<"\t\t\t"<<pitem_6;                             //DISPLAYING THE RECIPT
                    cout<<"\n\n\n----------------------------------------------------------";
                    subtotal=pitem_6*b;                                        
                    totalprice=subtotal+vat;
                    cout<<"\nSUBTOTAL       :"<<subtotal;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nVAT            :"<<vat;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nTOTAL PRICE    :"<<totalprice;
                    cout<<"\n----------------------------------------------------------";

                    cout<<"\n\n---------------------BILLING DETAILS--------------------";           // PRINTING BILLING DETAILS

                    cout<<"\n\nCUSTOMER NAME         :"<<customername;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nCONTACT NO            :"<<contact;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nADDRESS               :"<<address;
                    cout<<"\n----------------------------------------------------------";

                    // DISPLAYING THE MENU WITH UPDATED FOOD STOCK

                    cout<<"\n\n\n\n\t\t\tFOOD MENU";
                    cout<<"\n----------------------------------------------------"; 
                    cout<<"\n|"<<setw(5)<<"S No."<<setw(5)<<"|"<<setw(10)<<"Name"<<setw(5)<<"|"<<setw(10)<<"Price"<<setw(5)<<"|"<<setw(10)<<"In Stock"<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"1"<<setw(5)<<"|"<<setw(10)<<item_1<<setw(5)<<"|"<<setw(10)<<pitem_1<<setw(5)<<"|"<<setw(10)<<sitem_1<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"2"<<setw(5)<<"|"<<setw(10)<<item_2<<setw(5)<<"|"<<setw(10)<<pitem_2<<setw(5)<<"|"<<setw(10)<<sitem_2<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"3"<<setw(5)<<"|"<<setw(10)<<item_3<<setw(5)<<"|"<<setw(10)<<pitem_3<<setw(5)<<"|"<<setw(10)<<sitem_3<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"4"<<setw(5)<<"|"<<setw(10)<<item_4<<setw(5)<<"|"<<setw(10)<<pitem_4<<setw(5)<<"|"<<setw(10)<<sitem_4<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"5"<<setw(5)<<"|"<<setw(10)<<item_5<<setw(5)<<"|"<<setw(10)<<pitem_5<<setw(5)<<"|"<<setw(10)<<sitem_5<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"6"<<setw(5)<<"|"<<setw(10)<<item_6<<setw(5)<<"|"<<setw(10)<<pitem_6<<setw(5)<<"|"<<setw(10)<<sitem_6-b<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"7"<<setw(5)<<"|"<<setw(10)<<item_7<<setw(5)<<"|"<<setw(10)<<pitem_7<<setw(5)<<"|"<<setw(10)<<sitem_7<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

            }   

                // INPUT FOR ITEM NO 07 BY THE USER
}

                if (item_no==7 )


{

                    cout<<"\nHOW MANY SANDWICH DO YOU WANT: ";        // ASKING THE USER FOR INPUT
                    cin>>b;


                    if (b<=0 )
                    cout<<"\nINVALID INPUT\nTHANKS FOR USING OUR SERVICE";

                    else if(b>sitem_7)
                    cout<<"\n\nTHE STOCK IS LESS THAN YOU ORDERED.\nTHANKS FOR USING OUR SERVICE";     // IF STOCK IS LESS THIS MESSAGE WILL BE DISPLAYED


                    if (b>0 && b<=34 )
            {
                    cout<<"\n---------------ORDER SUMMARY------------------------ ----"<<endl<<endl;                // MAKING RECIPT OF THE FOOD SELECTED
                    cout<<"ITEM ORDERED\t\tQUANTITY\t\tUNIT PRICE"<<endl;
                    cout<<"----------------------------------------------------------"<<endl;
                    cout<<item_7<<"\t\t"<<b<<"\t\t\t"<<pitem_7;                                     //DISPLAYING THE RECIPT
                    cout<<"\n\n\n----------------------------------------------------------";
                    subtotal=pitem_7*b;                                        
                    totalprice=subtotal+vat;
                    cout<<"\nSUBTOTAL       :"<<subtotal;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nVAT            :"<<vat;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nTOTAL PRICE    :"<<totalprice;
                    cout<<"\n----------------------------------------------------------";

                    cout<<"\n\n------------------------BILLING DETAILS-----------------";           // PRINTING BILLING DETAILS

                    cout<<"\n\nCUSTOMER NAME         :"<<customername;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nCONTACT NO            :"<<contact;
                    cout<<"\n----------------------------------------------------------";
                    cout<<"\nADDRESS               :"<<address;
                    cout<<"\n----------------------------------------------------------";

                    // DISPLAYING THE MENU WITH UPDATED FOOD STOCK

                    cout<<"\n\n\n\n\t\t\tFOOD MENU";
                    cout<<"\n----------------------------------------------------"; 
                    cout<<"\n|"<<setw(5)<<"S No."<<setw(5)<<"|"<<setw(10)<<"Name"<<setw(5)<<"|"<<setw(10)<<"Price"<<setw(5)<<"|"<<setw(10)<<"In Stock"<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"1"<<setw(5)<<"|"<<setw(10)<<item_1<<setw(5)<<"|"<<setw(10)<<pitem_1<<setw(5)<<"|"<<setw(10)<<sitem_1<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"2"<<setw(5)<<"|"<<setw(10)<<item_2<<setw(5)<<"|"<<setw(10)<<pitem_2<<setw(5)<<"|"<<setw(10)<<sitem_2<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"3"<<setw(5)<<"|"<<setw(10)<<item_3<<setw(5)<<"|"<<setw(10)<<pitem_3<<setw(5)<<"|"<<setw(10)<<sitem_3<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"4"<<setw(5)<<"|"<<setw(10)<<item_4<<setw(5)<<"|"<<setw(10)<<pitem_4<<setw(5)<<"|"<<setw(10)<<sitem_4<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------";

                    cout<<"\n|"<<setw(5)<<"5"<<setw(5)<<"|"<<setw(10)<<item_5<<setw(5)<<"|"<<setw(10)<<pitem_5<<setw(5)<<"|"<<setw(10)<<sitem_5<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"6"<<setw(5)<<"|"<<setw(10)<<item_6<<setw(5)<<"|"<<setw(10)<<pitem_6<<setw(5)<<"|"<<setw(10)<<sitem_6<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

                    cout<<"\n|"<<setw(5)<<"7"<<setw(5)<<"|"<<setw(10)<<item_7<<setw(5)<<"|"<<setw(10)<<pitem_7<<setw(5)<<"|"<<setw(10)<<sitem_7-b<<setw(5)<<"|";
                    cout<<"\n----------------------------------------------------"; 

            }   


}                       return 0;   

}

For more details about Huffman coding click here

For other assignments and quizzes click here 

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *