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!