Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 7: Grade Entry Application In this assignment you will use conditional logic, input validation, and while loops to print student grades Overview Often when

image text in transcribed image text in transcribedimage text in transcribed image text in transcribed image text in transcribed

Assignment 7: Grade Entry Application In this assignment you will use conditional logic, input validation, and while loops to print student grades Overview Often when we are developing programs, we will need to write code that continues to run until some unknown number of iterations. This is very common scenario when we have unknown data sources. One such scenario is calculating grades for an assignment. The number of submissions each assignment is sometimes different. Therefore, regardless of how many students are in a course, the number of submissions may not be known. This program will allow a user to enter indi students' names and assignment grades. The program will then determine each student's letter grade and print a table of these values. The program will also compute and display the class average for the assignment. Instructions You are going to create a program that will prompt the user to enter a student's first name, last name, and grade (as a percent). After each student, the program will ask the user if they would like to enter another grade. If the user indicated they want to continue, the program will prompt them to enter another grade. If the user is done entering grades, the program will stop processing input and will display the student's results as well as calculate and display the class average. Make sure to use type hinting on all of your functions. Module 1. Create a module named grade_data.py 2. It will have at least the following four functions: a. get_first_name i. Accepts nothing ii. Returns the student's first name as a string b. get_last_name i. Accepts nothing ii. Returns the student's last name as a string C. get grade i. Accepts a student's first name as a string, ii. Prompts the user for the student's grade as a percent. The prompt must include the student's name. i.e. "Enter the grade for Fred:" iii. Determines if the grade entered is between 0 and 100 inclusive. 1. If the grade does not meet the criteria, the program will inform the user of their error and continue to prompt the user to re-enter the grade until a valid grade is entered. A while loop is required. 2. Hint: a sentinel loop would be a good idea here. iv. Returns a valid grade as a float. Example validation: Enter the grade for Fred: -1 The entered grade is not valid. The grade must be between 0 and 100. Enter the grade for Fred: 116 The entered grade is not valid.The grade must be between 0 and 100. Enter the grade for Fred: 106 Do you want to enter a grade? (y or nl d.get_letter_grade i. Accepts a grade as a float. ii. Returns the corresponding letter grade as a string iii. Use the table below for the appropriate ranges for each grade: Numeric Grade 90 - 100 80 - 89.9 70 - 79.9 60 - 69.9 Below 60 Letter Grade B D F e. get_continue_choice i. Accepts no arguments ii. Returns a boolean indicating if the user would like to enter another grade. iii. Asks the user if they would like to enter another grade and prompts the user to enter y or n. 1. Will accept either uppercase or lowercase letters. i.e. "Y" or "y" 2. If the user's response is not a "y" or an "n", the program will inform the user of their error and continue to prompt the user to re-enter their answer until a valid answer is submitted. A while loop is required. 3. Hint: a sentinel loop would be a good idea here. Example validation: Do you want to enter a grade? (y or nk I did not understand your choice. Please enter y or n. Do you want to enter a grade? ( y or n) no I did not understand your choice. Please enter y or n. Do you want to enter a grade? (y or ny What is the student's first name? f. format_output_row i. Accepts four values: 1. an integer for the student # 2. a string for the student's first name 3. a string for the student's last name 4. a float for the grade ii. Calls the appropriate function to get the letter grade iii. Returns a formatted string containing the student number, the student's first name, the student's last name, their grade as a number, their letter grade. For example, if it were printed, the string returned would look something like: 1 Fred Flintstone 76.5 C" Do NOT print the output in this function. This is only an example. 3. You can add more functions, but the first above. must be in this assignment and as speicifed Script 1. Create a script named grade_calculator.py 2. No functions are expected in this script, but you can create any if you feel they would help as long as the script runs as expected. a. Make sure to use type hinting and doc_strings if you make your own functions. 3. Hint: The following variables that will need to be created: a. A boolean loop variable (also known as a sentinel value) to determine when the user has entered all the grades b. A count of how many students have been entered. This is also the student number. c. An accumulator to track the total of all the grades entered so far d. An output variable that will contain cach row of the output table and will grow as each student's data is added 4. Create a while loop to process each student: a. For each student you will: i. Gather student information, calling any functions as needed. ii. Format the student information and add it to the output table. Hint: you will not print this information until all students are comeplete. iii. Keep a runinngin total of the class grade 5. When student grade entry is complete: a. Print the table containing student information. b. Calculate and display the average grade for the class. Structure Chart Script first neste grade Islame Shout con DUPUITOM astana gre mod.get_first_name mod.get_last name mad.get_grade mod.format output row mod.get_continue choice grade mod.get letter_grade Output An example output would be: What is the student's first name? Fred What is the student's last name? Flintstone Enter the grade for Fred: 76.5 Do you want to enter a grade? (y or ny What is the student's first name? Wilma What is the student's last name? Flintstone Enter the grade for Wilma: 82.4 Do you want to enter a grade? (y or ny What is the student's first name? Barney What is the student's last name? Rubble Enter the grade for Barney: 99.5 Do you want to enter a grade? (y or n) Class Grades: students first name 1 Fred 2 Wilma 3 Barney last name Flintstone Flintstone Rubble grade% 76.5 82.4 99.5 letter grade C B The average grade for the class was 86.13 Grade entry is complete

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions

Question

Organizing Your Speech Points

Answered: 1 week ago