Jump to content
Science Forums

Recommended Posts

Posted

Hi everybody,

 

can you help me to solve this problem ?!!

I need your help please ..

 

(1) Define a structure named menuItemSpecificationType that stores ingredients in a menu item (string [4]) and a brief description of the item (string).

(2) Define a structure named menuItemType with four components: num (int), name (string), description (menuItemSpecificationType), and price (double).

(3) Define a structure named selectedItemType with two components: num(int) and quantity (int).

(4) Write a program to help a restaurant automate its breakfast billing system. The program should do the following:

(a) Show the customer the different breakfast items offered by the restaurant.

(:eek2: Show the customer a description of a specific item according to the customer request.

© Allow the customer to select more than one item from the menu. The customer may ask for multiple items of one type.

(d) Calculate and print the bill.

 

Use an array, menuList, of struct menuItemType and an array choiceList of selectedItemType. Your program must contain at least the following functions:

 

(a) Function getData: This function loads the data into the array menuList. The number of menu items in the file is known. The prototype of the function is:

void getData(ifstream& inFile, menuItemType mList[], int listSize);

 

(:doh: Function showMenu: This function shows the different items offered by the restaurant and tells the user how to select the items. The function allows the user to select an item to display its description. The prototype of the function is:

void showMenu(menuItemType mList[], int listSize);

 

© Function makeSelection: This function allows the user to select menu items and specify their quantities. The prototype of the function is:

void makeSelection (menuItemType mList[], int listSize,

selectedItemType sList[], int& sListLength);

 

(d) Function printCheck: This function calculates and prints the check. Note that the billing amount should include a 5% tax). Format your output with three decimal places. The name of each item in the output should be left-justified.

The prototype of the function is: void printCheck(menuItemType mList[], int listSize, selectedItemType sList[], int sListLength);

 

 

 

Thanx in advance .. :evil:

Posted

....so basically you want us to do your homework for you? Sorry but we dont roll that way sister :eek2: how about you show what you have tried and we can help you with your understanding, instead of just answering the questions for you -which will seldom help your understanding.

Posted

first of all

it's not homework .. :P

 

O.K ,, Check this function to me

in this problem .. i have a file .. in it some meal ..

 

 

void getData(ifstream&infile,menuItemType mlist[],int size){

int i=0;

while (infile){

mlist.num=i+1;

getline(infile,mlist.name,'t');

for(int j=0;j<4;j++)

infile>>mlist.d.item[j];

getline(in,list.d.desc,'t');

infile>>mlist.price;

i++;}

Posted

I don't get what the problem is?

 

--is the struture of the Data too complex to relate effectively?

---why not just use a DataBase? - it's easier and more scalable.

----r u using Visual Studio? ... the time it took U to write the post u could of had half a class written that took care of accessing the DataBase.(or VS could have written it for you!)

 

there ar tons of already made restuarant POS systems already available... why not just buy one (source included)

Posted

What is the "d" attribute in your mlist object? Why does it have an array called "item" in it?

 

Pretty hard to follow what your code is trying to do without the data structure definition *and* the file layout.

 

What is this for anyway?

 

for( ;; ) wondering();

Buffy

Posted

Thanx for passing ,,

 

ErlyRisa ..

i want to solve this problem by structure ,, and i used visual c++

 

Buffy ..

d = description :sleeps:

 

 

look for that .. and please if you know the answer ,, help me

 

#include<iostream>

#include<fstream>

#include<string>

using namespace std;

void getData(ifstream&infile,menuItemType mlist[],int size);

void showMenu(menuItemType mlist[],int listSize);

void makeSelection(menuItemType mlist[],int listSize,selectedItemType slist[],int& slistLength);

void printCheck(menuItemType mlist[],int listSize,selectedItemType slist[],int slistLength);

 

 

struct menuItemSpecificationType{

string[4];

string description;

};

 

struct menuItemType{

int num;

string name;

menuItemSpecificationType descripion;

double price;;

};

 

struct selectedItemType{

int num;

int quantity;

};

 

void getdata(ifstream& infile, menyItemType mList[], int listSize){

 

int i=0;

while(in){

list.num=i+1;

getline(in,list.name,'t')

for(int j=0; j<4; j++)

in>>list.menuItemSpecificationType descripion.description.item[j];

getline(in,list.menuItemSpecificationType descripion.description,'t')

in>>price;

}

Posted

You're going to have to instantiate your variables. All you've got is individual structs.

 

The one function you've written could work, but its not clear because you haven't specified the file layout. It also has no error handling, so its likely to fail unless the input file is perfect.

 

You've got a ways to go. Unless you actually ask a question, there's not much more we can do. As Jay said, we're not going to write it for you.

 

Show all work,

Buffy

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...