Compute the final exam grade based on the combination of grades for exam1 (col 9) and grade for exam 2 (col 10) as follows.

MIS 315 – Fall 2022.  Programming Assignment #2.  

Objectives: Functions, Lists, lists of lists

This program and the next program work together.

Grading: 1.  10    2. 5    3.  10 (this is a B)  4. 5

QUESTION 1.Build a list of lists called studGrades, using the data in file DATA_PROJ2.txt, shown in canvas files.  For reference, I use the words “table”, “row”, and “column” for the”2 dimensional” list studGrades.

Each row contains the data for one student, and it will be used to compute the final letter grade of the student.  Data of one row are the following

Column 0: unique student id (a number)

Col 1:   “L” for the usual letter grading (A, B, …) , ”Cr” for Credit/noCr

Col 2: major – col 3: transfer student? -Col 4 -year

Col 5: gpa – col6 project 1 grade –Col 7 project 2 grade

Col 8: exam 1 grade – col 9: exam2 grade

To build the table studGrades in the Python program, copy and paste one row at a time from the file DATA_PROJ2.txt into the table studGrades.  Insert commas and “[“ and “]” where needed to make studGrades a correct list of lists (Murach top of page 179)

This table MUST be in main()

Print table studGrades, showing one row per line

 QUESTION 2.Compute the average gpa.  Compute how many students have their gpa greater than the average gpa.

PRINT both results from main()

You must use a function for this question, besides main().  The table studGrades must be a parameter of this function (not a global variable).  Both results must be returned to the calling program ( main()) using a “return” statement and printed from main()

QUESTION 3.  For each student, compute the final project grade based on the combination of grades for project 1 (col 6) and grade for project 2 (col 7) as follows(3 steps)

First step

newProj1grade = project1Weight*project1_grade

newProj2grade= project2Weight*project2_grade

Use :  project1Weight = 2  project2Weight = 1.5  .Those are “global constants” (Murach, page 114, 115, names of the constants should be in upper-case)

All rows have the same project1Weight. All rows have the same project2Weight

.Second step calculate:

projgrade = newProj1grade+ newProj2grade

Third, insert the value of projgrade at column 8 of studGrades for each row.  (note: insert, not append)

You must use a new function for this question

Print the following from main(): rows for student id 1111,  4555,  9500 with columns 0, 6, 7, 8, 9, 10

QUESTION 4. For each student, compute the final exam grade based on the combination of grades for exam1 (col 9) and grade for exam 2 (col 10) as follows.

First, compute firstKmod as follows:

Kmod = 1.2 for juniors who are not transfer students (col 3), Is 1.4 for juniors who are transfer from CC, is 1.5 for other juniors, is 2  for sophomores or seniors and grading type “L” (col 1), 2.5 for sophomores with grading type Cr, 1 for all other students

Then

newExam1grade = Exam1Weight*Exam1_grade

newExam2 grade=  Exam2Weight*Kmod*Exam2_grade

All students have the same Exam1Weight  = 3 (global constant)

All students have the same exam2Weight=5 (global constant

For each student, compute

examgrade = new Exam1grade+ new Exam2grade; append

Print the following from main(): rows for student id 1111,  4555,  9500 with columns 0, 9, 10, 11

You must use a new function for this question.

 

Compute the final exam grade based on the combination of grades for exam1 (col 9) and grade for exam 2 (col 10) as follows.
Scroll to top