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 17:30
Working on this program in python 3.7: a year in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: 1) the year must be divisible by 42) if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year.ex: if the input is 1712, the output is: 1712 is a leap year. ex: if the input is 1913, the output is: 1913 is not a leap year. your program must define and call the function isleapyear(useryear). the function should return true if the input year is a leap year and false otherwise.
Answers: 1
question
Computers and Technology, 22.06.2019 18:10
Assume that to_the_power_of is a function that expects two int parameters and returns the value of the first parameter raised to the power of the second parameter. write a statement that calls to_the_power_of to compute the value of cube_side raised to the power of 3 and that associates this value with cube_volume.
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Kto rozmawia z clamentain przez krótkofalówke w the walking dead w 4 epizodzie
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
During physical science class ben and jerry connected three identical lightbulbs in parallel to a battery where happens when ben removes one of the lightbulbs from it’s socket
Answers: 2
You know the right answer?
This project has the following requirements. General Requirements
Ask the user to input what...
Questions
question
Mathematics, 11.09.2019 01:30
Questions on the website: 13722361