P
perochak
Write a C++ program to calculate the GPA of students. Your program
should contain a class named Gpa. The class should have an array named
result, as its data member.
This array is meant to take the marks/grades of student in each course.
Hence the data member of the class Gpa should be of type Template.
Your program should have following member functions of a Template Class
T.
1: input()
This function will take input of marks/grades in each course from the
user.
2: cal_gpa()
This function will calculate gpa of the student according to the
entered marks/grades. The gpa will be calculated according to the
following criteria.
If a student gets more than or equal to 80 marks or take an A grade in
a course, he should be given 12 points against that course. Similarly,
if he gets more than or equal to 70 marks and less than 80 marks or
take a B grade in a course, then he should be given 9 points against
that course. Here is the table that depicts respective grading policy
Grades Marks Points
A >=80 12
B >=70 9
C >=60 6
D >=50 3
F <=49 0
3 credit hours are given for each course.
Final gpa is calculated by adding the points of each course and then
divide the added number by total number of credit hours.
For example:
Suppose if a student has taken 5 courses in a semester. Among which he
has taken 1 A, 1 B, 1 C, 1 D and 1 F. Then his Gpa will be calculated
as
(12 + 9 + 6 + 3 + 0 ) / 15
where 15 is the total number of credit hours in 5 courses.
Take two instances of Gpa class. One is of type int and other should be
of type char. Take marks as input for instance for int type and
students grades for instance of char type. Calculate and display Gpa
against both instances according to the way mentioned above.
Also write constructor and destructor for Gpa.
Sample Output:
Enter student's marks in each course:
90
85
80
75
75
The student's Gpa is 3.6
__________________________________
Enter student's grades in each course:
A
A
A
B
B
The student's Gpa is 3.6
should contain a class named Gpa. The class should have an array named
result, as its data member.
This array is meant to take the marks/grades of student in each course.
Hence the data member of the class Gpa should be of type Template.
Your program should have following member functions of a Template Class
T.
1: input()
This function will take input of marks/grades in each course from the
user.
2: cal_gpa()
This function will calculate gpa of the student according to the
entered marks/grades. The gpa will be calculated according to the
following criteria.
If a student gets more than or equal to 80 marks or take an A grade in
a course, he should be given 12 points against that course. Similarly,
if he gets more than or equal to 70 marks and less than 80 marks or
take a B grade in a course, then he should be given 9 points against
that course. Here is the table that depicts respective grading policy
Grades Marks Points
A >=80 12
B >=70 9
C >=60 6
D >=50 3
F <=49 0
3 credit hours are given for each course.
Final gpa is calculated by adding the points of each course and then
divide the added number by total number of credit hours.
For example:
Suppose if a student has taken 5 courses in a semester. Among which he
has taken 1 A, 1 B, 1 C, 1 D and 1 F. Then his Gpa will be calculated
as
(12 + 9 + 6 + 3 + 0 ) / 15
where 15 is the total number of credit hours in 5 courses.
Take two instances of Gpa class. One is of type int and other should be
of type char. Take marks as input for instance for int type and
students grades for instance of char type. Calculate and display Gpa
against both instances according to the way mentioned above.
Also write constructor and destructor for Gpa.
Sample Output:
Enter student's marks in each course:
90
85
80
75
75
The student's Gpa is 3.6
__________________________________
Enter student's grades in each course:
A
A
A
B
B
The student's Gpa is 3.6