pr2 - ENEE 150: Intermediate Programming Concepts for...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ENEE 150: Intermediate Programming Concepts for Engineers Spring 2011 Handout #18 Project #2: Recipe Database: Due March 30 at 11:59pm Initial Functional Decomposition Due March 16 at 11:59pm In this project, you will build a program that parses a recipe database, and allows the user to print summary listings of the recipes as well as to view specific recipes. Your project will be graded primarily on how faithfully it implements the functionality described in this handout, as determined by test vectors. Your project will also be evaluated on how well you decompose your code into functions. 1 Startup For this project, we have provided 3 recipe database files: recipes0.data, recipes1.data, and recipes2.data. You can download these files from the course website (just follow the Project 2 Files hyperlink). The first two files are quite small, containing 5 and 40 recipes, respectively. The last file is large, containing hundreds of recipes. Upon startup, your program will prompt the user to specify a recipe database file to parse by printing Enter database (0, 1, 2):, after which your program should expect a response of 0, 1, or 2. You may assume the user will always enter an integer, but he/she may not enter one of the 3 valid responses. If an invalid number is entered, your program should print Invalid input and re-prompt the user until a valid response is entered. Once a valid recipe database file is selected, your program should open the database file, read in the text data, parse it (see Section 2), and print the number of recipes found in the file. Then, your program should print a menu of options, and prompt the user for an option. Heres an example of how your program should start: z: pr2 Enter database (0, 1, 2): 5 Invalid input Enter database (0, 1, 2):-1 Invalid input Enter database (0, 1, 2): Parsed 5 recipes 1. Print summary 2. Print summary by prep time 3. Print summary by category 4. Print recipe 5. Exit Enter option: 1 In response to prompting for an option, the user must enter a number between 15. You may assume the user will always enter an integer, but he/she may not enter one of the 5 valid reponses. If an invalid number is entered, your program should print Invalid input and re-prompt the user until a valid response is entered. If a valid option is specified, your program should perform that option (see Section 3). After performing the option, your program should print the same menu, and prompt for another option. This should continue until the user enters option #5, at which time your program should exit. 2 Parsing a Recipe Database File A recipe database file is a text file containing several recipes. Individual recipes appear one after another in the database file, and consist of 3 parts: a header with various info about the recipe including its name, author, preparation time, and category descriptors; a list of ingredients; and a set of instructions for carrying out the recipe. Upon startup, your program should parse each of these 3 components for every recipe in the database...
View Full Document

This note was uploaded on 02/02/2012 for the course ELECTRICAL ENEE150 taught by Professor D.yeung during the Spring '11 term at Maryland.

Page1 / 8

pr2 - ENEE 150: Intermediate Programming Concepts for...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online