Question: Complete the following task for this assignment. Write a program that calculates category averages and overall course average for CS 1 7 0 . The

Complete the following task for this assignment.
Write a program that calculates category averages and overall course average for CS 170.
The grade categories are lab, programming assignments, exam1, exam2, and final exam.(Labs are worth 10%, programming assignments are worth 20%, exam 1 is worth 68%,
exam 2 is worth 25%, and the final exam is worth 25%).
Ex. If lab avg =70, pa avg =91, exam1 avg =68, exam2 avg =95, final exam avg =70:
=(70\times 0.1)+(91\times 0.2)+(68\times 0.2)+(95\times 0.25)+(70\times 0.25)=80%
Your program must display the grades and averages for each category. Your program will
also calculate and display the overall exam average and course grade (see sample run).
Input: This program uses separate input files for each grade category. All input files are
of unknown length and end with a sentinel value of -1:
LabGrades.py: contains lab assignment grades.
PaGrades.py: contains programming assignment grades.
Exam1Grades.py: contains exam 1 grades.
Exam2Grades.py: contains exam 2 grades.
FinalExamGrades.py: contains final exam grade.
In your code, you will read the data from each input file and store it in its list. Therefore,
you will have 5 separate lists to maintain.
Functions: Your program must include user-defined functions for the following tasks:
def GetMaxPts()
This function is used to prompt the user to enter the total number of points possible in
each category. These values are used in computing the category averages. The
function returns the maximum point values for labs, programming assignments, exam
1, exam 2, and the final exam (5 values). The function has no input parameters.
def AddNumsToList (listName, filename)
This function opens the input file specified by filename, reads the data, and appends
it to the list listName. The sentinel value indicating the end of the file is -1 for each
input file. The function returns the list containing the data to main().
def FindSimpleAvg (listName, totalPts)
This function calculates the average of the grade category. It accepts as parameters
the list of grades (listName) and the total number of possible points for that category
(totalPts). The function returns the calculated average to main(). This function does
not print any results.
def PrintGrades (category, listName, average)
This function prints the grades and averages for a single category. You will call this
function each time you want to display a set of grades and an average. The input
parameters are category (a string either Labs,PAs,Exam1,Exam2, or
Final Exam as appropriate), listName (the list of grades to be printed), and average
(the average that was calculated for the category).
def main():
The main function of your program will call the above user-defined functions. Unlike
other assignments with file input, there is no reading from the file loop in main().
This loop is in the AddNumstoList function. Since there is no user-defined function
for calculating the overall exam average and weighted course average, you can
include those calculations and printing in main().
NOTE: All code should be inside of a function. The only thing outside of a function (i.e.,
aligned all the way to the left) is the call to invoke main().
Output.
All averages should be displayed in two decimal places

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!