Assignment #2

Write two classes
Class RestaurantMenu that has the following members

class RestaurantMenu
{
    double price[10];
    string Menu[10];
    int numMeals;
public:
    RestaurantMenu();
    void AddToMenu(string s, double d);
    void DeleteFromMenu(string s);
    void ShowMenu();
    double FindMeal(string s);
};

The Constructor: will fill the price array with zeros and fill the Menu array with empty strings and make the numMeals equal zero.
Put the following in the object by default (Mansaf , 2.7) (Burger, 1.50) (Falafel , 0.5)
AddToMenu this function will add a new item to the menu Ex. AddToMenu(“Salad”, 0.30).
DeleteFromMenu function will delete an item from the menu by finding the Meal name and making it empty string and the price equal to zero and decrementing the numMeals. If the Meal name is not found print any message.
ShowMenu function wil print the menu (Item, Price)
FindMeal function will search the array Menu for the string s and return its price otherwise if it is not found it will return return -1

Class RestaurantOrder that has the following members

class RestaurantOrder
{
    double Bill[10];
    string order[10];
public:
    RestaurantOrder();
    ~RestaurantOrder();
    void AddToOrder(RestaurantMenu obj, string s);
    void DeleteFromOrder(string s);
    double CalculateBill();
};

The constructor: will fill the array Bill with zeros and the array order with empty strings
The Destructor will print a Good Bye
AddToOrder function will search for the string s in the Menu object (obj) to find its price and add the string and the price to the order
DeleteFromOrder function will search for the string s in the order object to delete it by making its Bill equal zero and its name equal empty string
CalculateBill function will return the summation of the Bill

Make 3 files (MenuClass.h) (OrderClass.h) (mainFile.cpp)
Write include for “MenuClass.h” in OrderClass.h file
Write inlcude for “OrderClass.h” in mainFile.cpp file

You need to make this project with full Decoration:
The Boss should make the list to add or delete items from the Menu as many as he/she wants
The Customer need to make his/her order then compute her/his Bill
Etc...

DueDate for this assignment is Monday 2 – 4 - 2012 evening

Recommended Answers

All 5 Replies

Help Me Please

What have you tried yourself? Where specifically are you stuck? We won't just do your homework for you.

Re. cscgal: amen to that! Poster has to make the first effort to solve the problem. Then we may decide to help out... :-)

I cant understand it never

please helpe me to find the errors

#include <iostream>
#include <string>
using namespace std;
class resturant
{
double price[10];
string minue[10];
int numMeals;
public:
resturant minue(){ int a ;string b ; price[10]=a , minue[10]=b; cout<<" ********** welcome to you in my resturant*********** ";}
void addToMinue(string s,double d);
void deletFromeMinue(string s);
void showMinue();
double findMeal(string s);
};
void resturant::addToMinue(string s,double d)
{
for (static int i=3;i<10;i++)
{
price[i]=d;
minue[i]=s;
i++;
}
minue[0]="mansaf";price[0]=2.70;
minue[1]="burgar";price[1]=1.50;
minue[2]="falafel";price[2]=0.5;
}
void resturant::deletFromeMinue(string s)
{
for(int i=0;i<10;i++)
if(s==minue[i])
{
minue[i]="  ";
price[i]=0;
}
string massege;
massege="sorry coustemr this meal un found ";
cout<<massege<<endl;
}
void resturant::showMinue()
{
for(int i=0;i<10;i++)
cout<<"the meals is : "minue[i]<<" the price is : "<<price[i]<<endl;
}
double resturant:: FindMeal(string s)
{   
for(int i=0;i<10;i++)
if(s != minue[i])
return -1.0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.