473,385 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Menu Madness Program

Hi guys, this is a question I have for an assignment, it is pretty long, but I am not asking for the code(well if someone wants to write I'll be really happy, lol), but I just want to know how to start it and what main topics in C I will need to cover in the assignment. Thanks a lot.


CSC180 Assignment #3: Menu Madness
Due Date: Thursday, November 8th at 1:00am

Contents:
· General Info
· What to Hand In
o Submission Instructions
· Compiler Instructions
· Program Design
o Documentation & Style
o Required Functions
· Rules
· Example Interface Interactions
· Hints & Tips

General Information
Webcomics are a fun and inexpensive form of entertainment. On the previous page is a
strip from a particularly geeky webcomic, hosted at http://www.xkcd.com. It makes
reference to a problem within computer science called NP-completeness, which refers to
the analysis of problems with no efficient solution.

In this case, there is a selection of appetizers, and the challenge is to find a combination
of them that will cost $15.05 in total. Can you figure out what this combination would
be? Can you design a program that can figure it out for you? Let’s hope so, because that’s
what you’re going to have to do for this assignment

What to Hand In
For this assignment, you will need to hand in the following 4 files, with the specified
contents:
· menu.c
 stores the prices of the menu items, and calculates the quantity of each
needed to arrive at the given total.
· menu.h
 stores the function prototypes for functions in menu.c
· tester.c
 stores the tester for the menu.c functions.
· interface.c
 prompts the user for input, acting as an interface between the user and the
menu.c functions.

We provide you with a starter version of menu.h. The other files must be created by you.

Program Design
Documentation and Style
The rules for documentation and style are the same as for Assignment 2. In addition to
this, you must also make sure to document the functions in your tester, to clarify the
intent of each test case.

There are two other style components of this assignment that you should consider:
1. The interface will prompt the user to enter options for using this menu tool. The
exact wording and prompting technique is up to you, but it must be a clean,
sensible, user-friendly interface. Consider the TAs that will be running and
marking your programs when you design them.
2. The required functions are outlined in the following section, but you are expected
to create more functions to implement smaller, intermediate tasks. Marks will be
deducted if you only implement the required functions, and no helpers.
Required Functions
You must implement the following functions for this assignment. Note that the names of
these functions are case-sensitive and may not be changed, nor are you allowed to change
the input or output parameters of these functions. Doing so will cause your code to fail
when run with our testing programs, and you will not receive any marks for functionality.


Function Name and Description

setItems
Take in three parameters: an integer that indicates how many prices
are on this menu, an array of strings that stores the names of the
menu items, and an array of doubles that stores the price values
for these items. Assume that no two price values will be the same.

addItem
Add another item and price to the menu. Assume that the new item
will not have the same price as an existing one.

removeItem
Take in a menu item as a string, and remove this item and price
from the menu. This function returns a 1 if the specified item was
removed, and a 0 if the item could not be found in the menu.

setTotal
Set the overall sum that this program must arrive at, as a double.

numItems
Return an integer, indicating the current number of menu items.

getItems
Return an array of strings, storing the current menu items.

getPrices
Return an array of doubles, storing the current menu prices.

getCount
Return an array of integers, representing the number of each item
needed to arrive at the given total. If no such combination exists,
return a NULL pointer instead.


Error Handling
As in any program, there may be incorrect inputs into your functions or your interface.
Here are the cases that you must handle.
Functions:
· Prices will generally have precision of two decimal places, but if they have more
then those additional decimal places should be rounded to two at the time of entry.
Any items with invalid price values should not be added to the menu.
· None of the inputs strings or arrays will have null values.
· If an invalid total value is provided, the original total should not change.
Interface:
· If the user enters an invalid option into the interface, display an error message and
prompt the user to try again.
· If the user enters any invalid values when prompted, continue prompting them for
a value until a valid one is entered.
· Appropriate messages should be displayed if the user requests removal of an item
that does not exist, or asks for a solution when there is none.


Rules
Every assignment has certain rules, to ensure that the correct skills are being tested.
Breaking any of the following rules will result in a significant penalty to your final mark:
1. Your program MUST compile and run on the ECF Linux machines.
2. Only the tester and interface files may have main() functions.
3. Your lines should not be more than 80 characters long (for printing reasons)
4. Every file you submit must include a name template at the top of the file. An
example name template would be the following:

/************************************************** ********
*
* File name: tester.c
*
* Author: Jane Doe
* Student Number: 123456789
* Date: Jan 1, 2007
*
* <program description goes here>
*
************************************************** ********/


Example Interface Interactions
Below is an example of what the interface to this program might do. Keep in mind that
this is just a sample. Yours may differ, but should have the same general spirit.
Welcome to Menu Madness!
Here are the actions you may perform:
(A)dd a menu item
(R)emove a menu item
(S)et a total price
(C)alculate the solution
e(X)it the program
Enter your selection (A, R, S, C, X):
> R
There are no items to remove.
Enter your selection (A, R, S, C, X):
> S
Enter the total price value:
> -4.00
That is not a valid price value.
Enter the total price value:
> 6.00
Enter your selection (A, R, S, C, X):
> C
You may not calculate the solution yet.
Enter your selection (A, R, S, C, X):
> A
You may not calculate the solution yet.
What menu item do you wish to add?
> Quesadillas
What is the cost of this item?
> 1.50
Enter your selection (A, R, S, C, X):
> C
The solution is:
4 x Quesadillas
Enter your selection (A, R, S, C, X):
> X
Thank you for using Menu Madness!
Nov 1 '07 #1
1 2484
Banfa
9,065 Expert Mod 8TB
There are 3 distinct poritions of this problem.

1. The user interface
2. Storing the data
3. The logic to solve the problem

The assignment helps a little by telling you in which file to implement each thing.

You can however design and implement these things separately, that is to design and implement the user interface you do not need to design and implement the logic.

You can sub-divide each item I have given into smaller problems. Keep doing that until the problems are small enough for you to solve, then solve all the little problems and all the big ones will have been solved too.
Nov 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Brian | last post by:
Hello, I want to design some menus for websites with submenus. I'd like to learn the code myself and I was wondering a good place to pick up on some tips on how to design them. Also, is there...
2
by: Phill | last post by:
I've got a text based system currently opperating via telnet sessions that I'm thinking of doing graphically w/.Net but am not sure If I can reproduce the same benefits in Windows. Basically it...
4
by: Bob Homes | last post by:
In VB6, I used a system, which I loved, whereby I assigned a "helpId" to each menu item; that way, you could rest the cursor on the item (without actually running it) and then press F1 to get...
2
by: Gary Wessle | last post by:
Hi I need help organizing this program in the right way. I included the code below which compiles and runs and gives the desired effect to a certain point, but I don't know what the next step...
3
by: Syl | last post by:
Hi Group - trying my question again. :-) I'dl like to use CSS to replicate the top navigation like this : http://www.checkeredshirt.com/jo-menu/ Currently - this nav menu everything is in a...
14
namcintosh
by: namcintosh | last post by:
Hello, everyone. Well, let me cut to the chase and explain my problem. I am trying to devise a menu plan that uses the if/else if and the while loop. The program calculates the user's weight...
20
by: raylopez99 | last post by:
Took a look at all the fuss about "lambda expressions" from Jon Skeet's excellent book "C# in Depth". Jon has an example, reproduced below (excerpt) on lambda expressions. My n00b take: it's...
0
by: Pavel Minaev | last post by:
On Aug 14, 1:37 pm, raylopez99 <raylope...@yahoo.comwrote: You are, of course, entitled to your opinion, but lambdas are a part of C# 3.0, and any C# developer has to know their ins and outs if...
2
by: colleen1980 | last post by:
Hi: Can any one please help how to i adjust menu at the center of the page? http://www.southeastneurology.com/testsite/indexnew.html Thanks.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.