Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

POLYTECHNI EMEX 101 Intro to Programming C++ Mini-Project (5% of Final Grade) Su

ID: 3907133 • Letter: P

Question

POLYTECHNI EMEX 101 Intro to Programming C++ Mini-Project (5% of Final Grade) Summer (2017-2018) INSTRUCTIONS: 1. Group yourself into groups of 1, 2, 3 (4 is the maximum, no exceptions) 2. Write a C++ application for a Restaurant Menu Selection and Billing process Minimum Specifications: a. The program will welcome the user Welcome to xxxxxx Restaurant. Please choose from the following menu:" b. The program will list 5 Starters and 5 Main Courses with prices (provide your own. Programs with the same menu will split the grade) c. The user will be prompted to select at least one starter with unlimited quantity d. The user will be prompted to select at least one main course with unlimited quantity e. It is possible that the user chooses starter only with no main course f. It is possible that the user chooses main only with no starter g. If a user chooses an invalid option, the program will prompt him that the input is nvalid h. The program will compute the total bill without VAT and display it i. The program will compute the final bill with 5% VAT and display it. 3. Submission Requirements a. Written Report (Hardcopy): Cover Page, Copy of Code, Screenshot of Example output (3%) b. Copy of Program submitted on LMS Dropbox (1%) C. 5 Minute presentation of program ( 1%) d. Last Day of Submission 21 June 2018 (4pm)

Explanation / Answer

ScreenShot

-------------------------------------------------------------------------

Program

//Header Files
#include<iostream>
#include<vector>
#include<string>
using namespace std;
//Function prototypes
void welcomeMessage();
void menu();
void totalBill(vector<string>& itemStart, vector<int>& countStart, vector<double>& costStart);
//Main method
int main()
{
   //variables for calculation and choice
   int total = 0;
   int ch, count;
   char dec;
   //vector to store user choice it's count and price
   vector<string> itemStart;
   vector<int> countStart;
   vector<double> costStart;
   //Call welcome function
   welcomeMessage();
   //Call menu display
   menu();
   //Starter order section
   cout << "Enter the starter do you want(1-5 or 0 no need):";
   cin >> ch;
   //User prompt until 0
   while (ch != 0) {
       if (ch == 1) {
           itemStart.push_back("Grilled Kebabs");
       }
       else if (ch == 2) {
           itemStart.push_back("Chicken Shawarma");
       }
       else if (ch == 3) {
           itemStart.push_back("Stir Fried Chilli Chicken");
       }
       else if (ch == 4) {
           itemStart.push_back("Cheese Balls");
       }
       else if (ch == 5) {
           itemStart.push_back("Hot Basil Chicken Cups");
       }
       cout << "how many plates do you want:";
       cin >> count;
       countStart.push_back(count);
       if (ch == 1) {
           total += 3.50*count;
       }
       else if (ch == 2) {
           total += 4.50*count;
       }
       else if (ch == 3) {
           total += 3.00*count;
       }
       else if (ch == 4) {
           total += 3.99*count;
       }
       else if (ch == 5) {
           total += 3.50*count;
       }
       costStart.push_back(total);
       total = 0;
       cout << "Do you want to continue order starters(y/n):";
       cin >> dec;
       if (dec == 'y' || dec == 'Y') {
           cout << "Enter the starter option(1-5 or 0 don't):";
           cin >> ch;
       }
       else if (dec == 'n' || dec == 'N') {
           ch == 0;
           break;
       }
   }

   //Main order section
   cout << "Enter the main course do you want(1-5 or 0 no need):";
   cin >> ch;
   //User prompt until 0
   while (ch != 0) {
       if (ch == 1) {
           itemStart.push_back("Spaghetti");
       }
       else if (ch == 2) {
           itemStart.push_back("Green Rice Poridge");
       }
       else if (ch == 3) {
           itemStart.push_back("Pasta");
       }
       else if (ch == 4) {
           itemStart.push_back("Chicken Biriyani");
       }
       else if (ch == 5) {
           itemStart.push_back("Main Dish Salad");
       }
       cout << "how many plates do you want:";
       cin >> count;
       countStart.push_back(count);
       if (ch == 1) {
           total += 8.00*count;
       }
       else if (ch == 2) {
           total += 7.00*count;
       }
       else if (ch == 3) {
           total += 6.50*count;
       }
       else if (ch == 4) {
           total += 8.50*count;
       }
       else if (ch == 5) {
           total += 5.50*count;
       }
       costStart.push_back(total);
       total = 0;
       cout << "Do you want to continue order starters(y/n):";
       cin >> dec;
       if (dec == 'y' || dec == 'Y') {
           cout << "Enter the main course option(1-5 or 0 don't):";
           cin >> ch;
       }
       else {
           ch == 0;
           break;
       }
   }
   //Total bill display function
   totalBill(itemStart, countStart,costStart);
    return 0;
}

//Welcome message function definition
void welcomeMessage() {
   cout << "          Welcome To XXXXXXXXX Restaurant" << endl;
}
//Display menu options
void menu() {
   cout << "Please choose from the following menu:" << endl << endl;;
   cout << "             Starters" << endl;
   cout << "1.Grilled Kebabs                 $3.50 2.Chicken Shawarma               $4.50 3.Stir Fried Chilli Chicken      $3.00 4.Cheese Balls                   $3.99 5.Hot Basil Chicken Cups         $3.50" << endl;
   cout << "          Main Course" << endl;
   cout << "1.Spaghetti                      $8.00 2.Green Rice Poridge             $7.00 3.Pasta                          $6.50 4.Chicken Biriyani               $8.50 5.Main Dish Salad                $5.50" << endl;
}
//Display total bill
void totalBill(vector<string>& itemStart, vector<int>& countStart, vector<double>& costStart) {
   int total = 0;
   for (int i = 0; i < itemStart.size(); i++) {
       total+=costStart[i];
   }
   welcomeMessage();
   for (int i = 0; i < itemStart.size(); i++) {
       cout << itemStart[i] << "        " << countStart[i] << "        $" << costStart[i] << endl;
   }
   cout << "--------------------------------------------- total                             $" << total << endl;
   cout << "VAT                 5%            $" << total * .05 << endl;
   cout << "--------------------------------------------- Bill                              $" << total+(total * .05) << endl;
}

--------------------------------------------------------------------------------------

Output

          Welcome To XXXXXXXXX Restaurant
Please choose from the following menu:

             Starters
1.Grilled Kebabs                 $3.50
2.Chicken Shawarma               $4.50
3.Stir Fried Chilli Chicken      $3.00
4.Cheese Balls                   $3.99
5.Hot Basil Chicken Cups         $3.50
          Main Course
1.Spaghetti                      $8.00
2.Green Rice Poridge             $7.00
3.Pasta                          $6.50
4.Chicken Biriyani               $8.50
5.Main Dish Salad                $5.50
Enter the starter do you want(1-5 or 0 no need):2
how many plates do you want:1
Do you want to continue order starters(y/n):n
Enter the main course do you want(1-5 or 0 no need):4
how many plates do you want:1
Do you want to continue order starters(y/n):n
          Welcome To XXXXXXXXX Restaurant
Chicken Shawarma    1        $4
Chicken Biriyani        1        $8
---------------------------------------------
total                                 $12
VAT                 5%            $0.6
---------------------------------------------
Bill                             $12.6
Press any key to continue . . .

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote