Question: Exercise 2 Back to the basics! Write a program that asks the user the number of courses he is taking this semester, then asks the

Exercise 2 Back to the basics! Write a program that asks the user the number of courses he is taking this semester, then asks the user to enter the course codes and grades, and finally prints the average of the grades this semester. No need for input validation in this exercise! Sample run: Enter the number of courses that you are taking this semester: 4 Enter the course code for course W1: CoNm1020 Enter the grade obtained in com1020: 92 Enter the course code for course 2 2: INFS1201 Enter the grade obtained in INFS1201: 78 Enter the course code for course \#3: INFT1201 Enter the grade obtained in INFT1201: 96 Enter the course code for course \#4: MATH1030 Enter the grade obtained in MATH1030: 86 Your average for this semester is: 88.6 Exercise 3 Actually, not all courses have the same weight: the weight depends on the credit value. Modify the previous code to request the credit value of each course and compute the weighted average: the weighted average represents the sum of the grades multiplied by their credit value divided by the sum of all credits. Here is a sample run: Enter the number of courses that you are taking this semester: 4 Enter the course code for course \#1: CoNm1020 Enter the number of credits of comm1020: 3 Enter the grade obtained in Comm1020: 92 Enter the course code for course W2: INFS1201 Enter the number of credits of INFS1201: 4 Enter the grade obtained in INFS1201: 78 Enter the course code for course \#3: INFT1201 Enter the number of credits of INFT1201: 4 Enter the grade obtained in INFT1201: 96 Enter the course code for course \#4: MATH1030 Enter the number of credits of MATH1030: 3 Enter the grade obtained in MATH1030: 86 Your average for this semester is: 87.85714285714286
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
