Help on this Programming Assignment

Programming Assignment: Pizza Box
This program will read a typical menu from a pizza store that contains an item name and an associated price. There will only be 20 items to keep things simple.

Section 1: Read Menu Items into an array of structure elements
1. Add code to main that opens and reads all data from this input file. This file contains 20 items and two fields per line: item and price. The item will be 30 characters or less.
2. To hold the items present tin menu.txt you will need to create a structure called menu_items. This structure will have 2 items it and must be declared to be an array.
3. You should declare an integer constant called NUM_MENU_ITEMS that you initialize to 20. I do not want to see 20 hard-coded anywhere. You must use your global constant instead.
4. To receive complete credit your program should use the fail method to ensure that the input file can be opened it should return a meaningful error message if it cannot.



Here is the menu.txt stuff that was given as well:
ChickenFingers 6.75
BuffaloChickenFinger 6.95
FrenchFries 3.05
CheeseFries 4.10
BeachFries 3.60
GardenSaladSmall 3.95
GardenSaladLarge 5.50
GreekSaladSmall 6.00
GreekSaladLarge 7.75
CaesarSmall 4.75
CeasarLarge 8.25
BuffaloWings6 8.50
BuffaloWings12 16.75
BuffaloWings24 31.40
PlainSteak 6.85
CheeseSteak 7.35
PlainPizzaSmall 6.75
PlainPizzaMedium 9.95
PlainPizzaLarge 13.25
Stromboli 9.10

Please help and tell me how to do this! Thanks
closed account (j3Rz8vqX)
What exactly do you need help with?

First Instruction:

-Open the file.

-Check if file is opened.//<<------------Instruction #4

-Use a loop to read data from the file.

--Read a string, then a float or double.

--Repeat till eof

Second Instruction:

-Make a structure called "menu_items"

--It will hold two items (ideally the string and float/double?)

Third Instruction from our respected professor:

-No hard coding ANYWHERE (the size of items that is). No "20" coded ANYWHERE!

Fourth Instruction:

-I posted it in instruction #1.

Doesn't look to hard.

Design the blue print and try to implement it; don't code around your problems, they'll only hurt more.

Post for help, if your stuck; use the code tag <> if you decide to post any code.

Have a good day.

=D
Topic archived. No new replies allowed.