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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 19:40, Latoyajenjins1789
Use a physical stopwatch to record the length of time it takes to run the program. calculate the difference obtained by calls to the method system. currenttimemillis() just before the start of the algorithm and just after the end of the algorithm. calculate the difference obtained by calls to the method system. currenttimemillis() at the start of the program and at the end of the program so that the elapsed time includes the display of the result. use the value returned by the method system. currenttimemillis() just after the end of the algorithm as the elapsed time.
Answers: 3
image
Computers and Technology, 23.06.2019 20:30, cristalcastro901
If an appliance consumes 500 w of power and is left on for 5 hours, how much energy is used over this time period? a. 2.5 kwh b. 25 kwh c. 250 kwh d. 2500 kwh
Answers: 1
image
Computers and Technology, 24.06.2019 02:00, arubright177
Write an expression that will cause the following code to print "equal" if the value of sensorreading is "close enough" to targetvalue. otherwise, print "not equal". ex: if targetvalue is 0.3333 and sensorreading is (1.0/3.0), output is:
Answers: 1
image
Computers and Technology, 24.06.2019 02:00, ishmael9332
How are we able to create photographs differently than 100 years ago? explain your answer in relation to your photograph you selected.
Answers: 1
You know the right answer?
This project has the following requirements. General Requirements
Ask the user to input what...

Questions in other subjects:

Konu
History, 15.11.2019 15:31
Konu
Spanish, 15.11.2019 15:31
Konu
Mathematics, 15.11.2019 15:31
Konu
Mathematics, 15.11.2019 15:31