subject

This project has the following requirements. General Requirements
Ask the user to input what value they are interested in.
Output to the user a sorted list of the top 5 items based on the option.
Specific Requirements:
The main function must meet these requirements:
The code will continue to ask the user for additional input until the user inputs the value 12 for the menu
The code will call both of the functions described below
The code will read the data file - you should only need to read the data file one time, so you can do that prior to entering the loop mentioned above.
The code will also contain the following 2 functions, with the specified arguments:
printMenu()
this function has no arguments
this function prints the menu shown below
Select from the following options:.
1) Category
2) Item
3) Serving Size
4) Calories
5) Calories from Fat
6) Total Fat
7) Cholestrol
8) Sodium
9) Carbohydrates
10) Protein
11) Sugars
12) Quit
Enter Number Command:.
validate the input value from the menu to ensure it is numerical using the try/except
validate that the value input is one of the menu values - 1 through 12
this function will return the value entered by the user to the main function
processInput( userInput )
there is a single argument. This is the value entered by the user in response to the menu. This value is returned from the printMenu()
function then passed to the processInput() function
the function will sort the data according to the user input, and print out the top 5 entries
the function does not return any value
Phase 1 Requirements:
Code submitted for Phase 1 will only have the following capability. Any additional coding will result in the loss of point.
code will have the main function, including looping until the user enters input of 12
code will call the printMenu() function
theprintMenu() function will have the capability to print the menu and receive input. AT THIS TIME do not worry about implementing the try/except code
the code MUST return the value entered by the user - IT IS NOT REQUIRED to return an integer - BUT - the code MUST return the value (remember - the input() function returns a string) entered by the user to the main function. Some students figure out a way to use the string value, so you do not have to return an integer.
the main function will have a simple print statement outputting the statement "The user input the value ??" - where the ?? will be replaced by the value the user entered.
Phase 2 Requirements:
code will meet all requirements from Phase 1
code in the printMenu() function will be added to include a try/except to catch errors if the user enters a non-numeric value in response to the menu prompt.
code in printMenu() will also need to check for input of values outside the range of 1-12, and handle them appropriately.
code will have the main function calling the processInput() function that accepts a single argument
the argument to the function will be the value returned from the printMenu() function
use a different variable name in your main code and in your function
create a list named headings[ ]
the headings list should contain all the Headings from the menu except 'Quit'...so you have all 11 elements in the list from your menu.
using the value that is passed into the processInput() function print not only the numerical value of that argument - but also print the proper item from the headings[ ] list.
Phase 3 Requirements:
code will meet all requirements from Phase 2
code to read the input file will be added to the main function
the processInput() function will sort the data read from the file
the processInput() function will print out the top 5 items based on the input value
You can test your code - below are two input values and the output you should see.
Enter a value 4
Top 5 Items Based On Calories:
1| "Chicken McNuggets (40 piece)" 1880
2| "Big Breakfast with Hotcakes (Large Biscuit)" 1150
3| "Big Breakfast with Hotcakes (Regular Biscuit)" 1090
4| "Big Breakfast with Hotcakes and Egg Whites (Large Biscuit)" 1050
5| "Big Breakfast with Hotcakes and Egg Whites (Regular Biscuit)" 990
Enter a value 7
Top 5 Items Based On Cholesterol :
1| "Big Breakfast with Hotcakes (Regular Biscuit)" 575
2| "Big Breakfast with Hotcakes (Large Biscuit)" 575
3| "Big Breakfast (Regular Biscuit)" 555
4| "Big Breakfast (Large Biscuit)" 555
5| "Steak & Egg McMuffin" 300

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
Ap practice - performance task response the ap create performance task asks you to write about an abstraction that you developed and wrote into your code. most of the time that means identifying a function or procedure you wrote to "manage complexity" in your program. here is the actual prompt from the create performance task: 2d. capture and paste a program code segment that contains an abstraction you developed individually on your own (marked with a rectangle). this abstraction must integrate mathematical and logical concepts. explain how your abstraction manage the complexity of your program. (must not exceed 200 words) below is a segment of code from an "under the sea" program with a rectangle drawn around a portion of the code identifying an abstraction. imagine that you wrote this and are composing an ap response about how this abstraction manages complexity. (note: ignore the requirement that the abstraction integrate "mathematical and logical concepts" for this practice response. just write about managing complexity). explain how the abstraction marked with the rectangle in the code above manage complexity of this program. write your response here submit
Answers: 2
question
Computers and Technology, 22.06.2019 11:00
When building customer relationships through email what should you not do? question 2 options: utilize proper grammar, spelling, and punctuation type in all capital letters use hyperlinks rather than attachments respond to all emails within 24 hours
Answers: 1
question
Computers and Technology, 22.06.2019 22:40
When you type the pwd command, you notice that your current location on the linux filesystem is the /usr/local directory. answer the following questions, assuming that your current directory is /usr/local for each question. a. which command could you use to change to the /usr directory using an absolute pathname? b. which command could you use to change to the /usr directory using a relative pathname? c. which command could you use to change to the /usr/local/share/info directory using an absolute pathname? d. which command could you use to change to the /usr/local/share/info directory using a relative pathname? e. which command could you use to change to the /etc directory using an absolute pathname? f. which command could you use to change to the /etc directory using a relative pathname?
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
What is the main benefit of minimizing the ribbon in word? more options will be accessible through customized keystrokes. more of the document will be viewable without needing to scroll. fewer controls will be accessible to the user by using the mouse. fewer editing options will be available without entering a password.
Answers: 1
You know the right answer?
This project has the following requirements. General Requirements
Ask the user to input what...
Questions
question
Mathematics, 05.05.2020 13:34
question
Mathematics, 05.05.2020 13:34
question
Mathematics, 05.05.2020 13:34
question
Mathematics, 05.05.2020 13:34
question
Mathematics, 05.05.2020 13:34
question
Physics, 05.05.2020 13:34
Questions on the website: 13722361