Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4 (13 points): Purpose: Solve a problem by writing multiple functions that perform different subtasks, and combining their use to solve a larger problem.

image text in transcribedimage text in transcribed

Question 4 (13 points): Purpose: Solve a problem by writing multiple functions that perform different subtasks, and combining their use to solve a larger problem. Also to practice documenting functions. Degree of Difficulty: Moderate Ebenezer is an undergraduate computer science student who just finished taking his first course. The course consisted of three major assignments and one final project. He has received a complete list of grades from his instructor and has access to the grading scheme from the course syllabus. He is looking for a tool to help him calculate his final grade. Your task is to write a Python program that calculates and displays Ebenezer's final grade using weighted averages. To accomplish this, you will need to write three Python functions: calc-project, calc_assignments and calc_final. The calc-project function should have parameters grade (percentage obtained on the project) and weight (as a decimal value). It should calculate a weighted project grade: project_weighted average = project-grade x project_weight The calc_assignments function should have parameters a1_grade, a2-grade, a3_grade (percentages ob- tained on each assignment) and weight (the decimal value weight of all three assignments combined). It should calculate a weighted grade of all three assignments combined: (weight)(al-grade + a2-grade + a3_grade) assignment_weighted_average = ( 3 The calc_final function determines Ebenezer's grade as a percentage. It should: call calc-project and calc_assignments and use their return values to compute the final grade return the computed grade The parameters of the calc_final function should be chosen so that they provide the necessary informa- tion required to call the calc-project and calc_assignments functions. The final grade is: final_grade = project_weighted_average + assignment_weighted average Write code to ask the user for all necessary inputs, then display the calculated final grade to the console. Remember to write appropriate docstrings for each function which states their purpose, parameter(s), and return value(s). To demonstrate your program is working correctly, first prepare and solve (by hand) three different sce- narios. Once you have the scenarios designed and the right answers calculated, run your program three times, once for each scenario where you type in the values you chose. Copy the console output from each of your three demonstration examples into a text file and hand in that text file (see "What to Hand In" below). You may assume that the user supplies valid input from the console. That is, the user is assumed to enter valid, floating-point weights which add up to exactly 1.00 and valid grades between 0 and 100. See the sample run on the next page. Sample Run Here is an example of how your program's console output might look. Green text was entered by the user; blue text came from data returned by the functions. What grade did you achieve on the project? (%): 75 What is the project worth? (0-1): 0.45 What grade did you achieve on assignment 1? (%): 85 What grade did you achieve on assignment 2? (%): 96 What grade did you achieve on assignment 3? (%): 78 What are all the assignments combined worth? (0-1): 0.55 Final Grade: 81.23% Tip: You may wish to use the built-in function round to limit the number of decimal places when printing your results, but this is not required

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions