Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program to calculate a students GPA for the semester. The program should accept a student's name, the ID number and the number

Write a C++ program to calculate a students GPA for the semester. The program should accept a student's name, the ID number and the number of courses he/she is taking. For each course the following data is needed

  • the course number a string e.g. CIS 161
  • the course credits "an integer" e.g. 4
  • the final grade received for the course "a character". e.g. A

The program should write to a file the student's name, ID number, the total number of credits that the student is taking, and the students Grade Point Average (GPA) for the semester. A warning message should be included in the output if the GPA is less than 2.0 and a congratulatory message if the GPA is 3.0 or above. The report will print a line for each student. Check below how to find the gpa for a student.

Calculating the GPA

John is taking 3 classes

CIS 161 4 Credits grade C

MA 101 3 Credits grade A

SO 101 2 Credits grade B

C = 2 points total, points earned for CIS 161 is 4 * 2 = 8 // credits * points for C grade.

A = 4 points total, points earned for MA 101 is 3 * 4 = 12 // credits * points for A grade.

B = 3 points total, points earned for SO 101 is 2 * 3 = 6 // credits * points for B grade.

Total points earned is 8 + 12 + 6 = 26 points

Total credits earned is 4 + 3 + 2 = 9

The GPA for John is 26/9.0 = 2.89.

Sample output

&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~

Students GPA report

Falls 2018 Semester

&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~

Name ID # Total # Of Credits GPA Message

Rose Declet 305867 13 3.7 Congratulations

BrianCapri 329934 14 2.0

Sam Brown 302930 8 1.9 Warning

Requirements:

  • Input student's name, ID number, course number, number of credits for the course and grade using proper prompts.
  • Use a loop to repeat for multiple students until 'N' or 'n' is entered in response to a prompt.
  • Create constants representing the points for each grade.
  • A 4 points
  • B 3 points
  • C 2 points
  • D 1 points
  • F 0 points
  • Calculate using the constants you defined, and whatever data the user enters.
  • Use at least 4 self-contained functions.
  • Include data validation for all data entered

ID Range 0-9999

Number of courses 1 - 5

Grades are A,B,C,D,F.

  • Have your program proper heading and column titles for the output.
  • Output the report as specified above.
  • Document your program, use comment, not excessive, to explain.
  • Use functions specifications to explain functions

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions