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

This week you will start on an Italian Restaurant Ordering Program. For starters

ID: 3741607 • Letter: T

Question

This week you will start on an Italian Restaurant Ordering Program.

For starters, you will create an abstract base class called menuItem. This will have an attribute of name, a method getName, abstract method getPrice, and abstract method toString (which returns a string with the item name, description, and price)

You will create subclasses (all of which extend from menuItem) for

Pizza, Pizzas can be

personal,

medium,

large, or

family

SandwichSandwiches can be

6 Inch

Foot Long

AppetizerWingsWings can be

Traditional

Boneless

BreadBread can be

Cheesy Bread

Garlic Bread

For starters (we will revise this later):

Pizzas will have a price based on their size ($5.99, $6.99, $12.99, $14.99).

Sandwiches will be priced based on size ($6.00, $8.00)

Wings will cost $.70 per boneless and $.60 per traditional (to keep it simple each wing order will have a type and quantity – no mixing).

Bread will be $7.99 for Cheesy and $6.99 for garlic.

Create a menu driven program that will allow the user to add menu items (pizza, sandwiches, wings, and breads) to an order (use only one data structure to hold your order items). Add at least one item from each category to your order and then print out the list of items ordered (name, description, and price). Display the number of items ordered and the total price.

Below is my partial code:

#include <iostream>

#include <string>

using namespace std;

class menuItem{

private:

string name;

public:

string getName(){

return name;

}

virtual void getPrice() = 0;

virtual void toString() = 0;

};

class Pizza : public menuItem{

private:

double personal = 5.99;

double medium = 6.99;

double large = 12.99;

double family = 14.99;

public:

void getPrice(){

cout << "price" << endl;

}

};

class Sandwich : public menuItem{

private:

double sixInch = 6.00;

double FootLong = 8.00;

public:

void getPrice(){

cout << "price" << endl;

}

};

class Appetizer : public menuItem{

class wings : public Appetizer{

  

};

};

int main(){

  

}

Explanation / Answer

ANS:-

PROGRAM:-

// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<iostream>
#include<string>
#include<iomanip>
#include<cstdlib>// allows use of system pause
using namespace std;
struct menuItemType
{
   string menuItem;
   double menuPrice;
};
void getdata(menuItemType[], menuItemType[], int&);// array for user to enter data
void showMenu(menuItemType[], int);// array displaying options
void printCheck(menuItemType[], int); //array stores data
int main()
{
   int items = 0;
   menuItemType menuList[] = {
       "Pizza (Personel) ", 5.99,
       "Pizza (Medium) ",6.99,
       "Pizza (Large) ",12.99,
       "Pizza (Family) ",14.99,
       "Sandwhich(6 inch) ",6,
       "Sandwhich(footlong) ",8,
       "Wings(Traditional) ",0.6,
       "Wings(Boneless) ",0.7,
       "Bread(cheesy Bread) ",7.99,
       "bread(Garlic Bread) ",6.99,
      
   };
   menuItemType order[10];
   cout << "Welcome to the Baltazar Kitchen! Menu: Item: Price: ";
   showMenu(menuList, 10);// displays menu directly underneath item
   getdata(menuList, order, items);// user inputs data
   printCheck(order, items);//stores and asks for other items
   system("pause");
   return 0;
}
void printCheck(menuItemType order[], int items)
{
   int i;
   double total = 0, tax;
   cout << "Your Check Ordered Items Item price ";
   showMenu(order, items);
   for (i = 0; i<items; i++)
       total += order[i].menuPrice;
   cout << " Item total " << "$" << setprecision(2) << fixed << total << endl;
   tax = total*.07;//standard tax for st. louis area
   cout << "Tax " << "$" << setprecision(2) << fixed << tax << endl;
   cout << "Amount Due " << "$" << setprecision(2) << fixed << total + tax << endl;
}
void getdata(menuItemType menu[], menuItemType order[], int& items)
{
   char yesno = 'Y';
   int n;
   while (toupper(yesno) == 'Y')
   {
       cout << "Enter your order item number: ";
       cin >> n;
       while (n<1 || n>10)
       {
           cout << "invalid item number ";
           cout << "Enter your order item number: ";
           cin >> n;
       }
       order[items].menuItem = menu[n - 1].menuItem;
       order[items].menuPrice = menu[n - 1].menuPrice;
       items++;
       cout << "Would you like another item?(y/n)? ";
       cin >> yesno;
   }
}
void showMenu(menuItemType a[], int n)
{
   int i;

   for (i = 0; i<n; i++)
       cout << i + 1 << ". " << setw(16) << left << a[i].menuItem << "$" << setprecision(2) << fixed << a[i].menuPrice << endl;
}

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