Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 Exercise 4 At UDST, the GPA is a weighted average, not of the grades directly but of grade points. Grade points are converted from grades According to the below table: Add to the previous code, a function grade2GP that takes a grade as input and returns the corresponding grade point. Use this function to compute the semester GPA. Here is a sample run: Enter the number of courses that you are taking this semester: 4 Enter the course code for course \#1: COMM1020 Enter the number of credits of COMM1020: 3 Enter the grade obtained in CoMM1020: 92 Enter the course code for course \#2: 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 semester GPA is: 3.4642857142857144
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started