# CodeStepByStep Language/Type: Python interactive programs parameters return

Write a console program that helps a student estimate their grades in a course. Your program uses a student's grades on homework, a midterm exam, and a exam to compute an overall course grade as a weighted average. The student's points earned in each category are divided by the total possible points for that category and multiplied by the category's weight. The program either computes the student's course grade (if the student has taken the exam) or tells the student what score he/she needs to earn on the to achieve a certain course grade.

```This program reads your scores on homework
what score you need on the exam.

Exam weights? 20 30

Homework (weight 50):
Number of assignments? 3
Assignment 1 score and max? 14 15
Assignment 2 score and max? 17 20
Assignment 3 score and max? 19 25
Sections attended? 5
Section points = 15 / 20
Total points = 65 / 80
Weighted score = 40.6

Exam (weight 20):
Score? 78
Curve? 3
Total points = 81 / 100
Weighted score = 16.2

Have you taken the final? (1=yes, 2=no) 1
Exam (weight 30):
Score? 95
Curve? 10
Total points = 100 / 100
Weighted score = 30.0

```

The program asks the user for weights of the two exams. You should subtract the sum of the exam weights from 100 to get the homework weight. Next the user enters how many homework assignments were given. For each assignment, the user enters his/her score and the max score. Use a cumulative sum to compute homework scores. Part of the homework score comes from sections the student attended. Each is worth 3 points, up to a maximum of 20.

The user next enters his/her midterm exam score. The maximum exam score is 100. If the exam was curved, these points are added to the user's score, up to a max of 100. The program can be run before or after the exam, so first the user enters whether it has been taken 1 means yes, 2 means no. If it has, the user enters his/her score and the curve, and the student's grade is shown. If not, it computes the exam score needed to earn a particular course grade.

If the student can achieve the desired course grade without taking the (in other words, if a exam score = 0 is needed), the program shows 0.0 as the needed score. If the needed score is above 100, the program indicates this and shows the highest course grade the student can get (the grade that would result if the student earns 100 on the exam).

You should handle two special cases of user input: First, a student can receive extra credit on an assignment for example, 22 / 20 is a legal score. But the total homework points are capped at the max possible. If a student receives a total of 63 / 60, you should cap this to 60 / 60. Second, the maximum score for an exam is 100. If the curved exam score exceeds 100, a score of 100 is used.

You should break down your program into several functions that use parameters and returns to exchange data.

Complete program: Write an entire program that you could put into a file and run outside of CodeStepByStep.