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
The grade categories are lab, programming assignments, exam exam and final exam.Labs are worth programming assignments are worth exam is worth
exam is worth and the final exam is worth
Ex If lab avg pa avg exam avg exam avg final exam avg :
times times times times times
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 :
LabGrades.py: contains lab assignment grades.
PaGrades.py: contains programming assignment grades.
ExamGrades.py: contains exam grades.
ExamGrades.py: contains exam 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 separate lists to maintain.
Functions: Your program must include userdefined 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
exam and the final exam 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 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 LabsPAsExamExam 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 userdefined 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 userdefined 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 ie
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
