Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program to calculate a student's GPA for a single semester. The program is to be written for a normal course load, i.e., assume

Write a program to calculate a student's GPA for a single semester. The program is to be written for a "normal" course load, i.e., assume that the student has taken five courses. The program should do the following:

Input

  1. Name of course, e.g., CS20 This question must use ordinal numbers, i.e., the questions should take the form of: What was the 1st course that you took?, What was the 2nd course that you took?, etc. It is not acceptable for the questions to be: What was course #1?, What was course #2?, etc. --- or to omit numbering entirely, as in: What is the next course? [NOTE: do not use an if-elif-else structure to accomplish this.]
  2. Grade in the course. The question should include the name of the course. The program should expect standard upper-case letter grades: A, B+, B, C+, C, D, F, W.

NOTE: Given the tools available to you at the moment, using an input validation loop would not be a good idea. If the user enters an invalid grade, allow the program to continue, but inform the user of his error and tell him that this course will not be included in the GPA calculation.

  1. Credits for the course. The question should include the name of the course.

Process

The program should calculate two values:

  1. The number of quality points that the student earned for each of the courses.
  2. The student's overall GPA for the semester.

[Note: Both of these calculations are explained on the next page.]

Output

The program should print each of the above calculated values:

  1. The quality points for each course should be printed immediately following the questions pertaining to that course. The output should include the name of the course.
  2. The overall GPA - three decimal places - should be the last line printed at the end of the program.

Requirements

  1. There should be only three input statements in the program to be executed multiple times.
  2. There should be only two print statements in the program:
    1. one to print the quality points for each course to be executed multiple times
    2. one to print the student's overall GPA
    3. NOTE: any error message(s) or print statements to make the output easier to read would be in addition to the above "only two"
  3. All input and print statements should be grammatically and typographically correct spelling, spacing, punctuation, etc.
  4. The output statements should be sentences, not just numbers.

Program=python

Calculation of GPA

overall GPA = total quality points attained divided by total credits attempted

Quality Points Attained

The quality points attained for each course is equal to the credits for that course multiplied by a factor determined by the student's letter grade received for the course. This table gives the letter grade to factor correspondence:

Letter Grade

Factor

A

4.0

B+

3.5

B

3.0

C+

2.5

C

2.0

D

1.0

F

0.0

The total quality points attained is the sum of the quality points for all of the courses taken by the student.

Credits Attempted

The total credits attempted is the sum of the credits associated with each of the courses taken by the student --- not counting courses from which the student has withdrawn, i.e., if the letter grade is "W", the credits for that course are not included in determining the total credits attempted.

The language is python. This is all that I know. The basic functions I will say can be used but not the complex ones. Loops (for and while) can be used as well as if else or if elif or else

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions