解决这个问题 [英] Solve this question

查看:63
本文介绍了解决这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写一个C ++程序来计算学生的GPA。你的程序

应该包含一个名为Gpa的类。该类应该有一个名为

result的数组作为其数据成员。


此数组用于获取每个课程中学生的分数/等级。

因此Gpa类的数据成员应该是Template类型。


您的程序应具有以下模板类的成员函数

T.


1:输入()

此功能将从
$ b中获取每个课程中的分数/成绩输入$ b用户。


2:cal_gpa()


此函数将根据
$ b计算学生的gpa $ b输入标记/等级。 gpa将根据

以下标准计算。


如果学生得分超过或等于80分或者取得A等级/>
a当然,他应该得到12分反对该课程。同样地,如果他获得超过或等于70分并且少于80分或者在一个课程中获得B等级,则需要获得9分。

当然。以下是描述各自评分政策的表格


等级标记积分

A> = 80 12

B> = 70 9

C> = 60 6

D> = 50 3

F< = 49 0

每门课程可获得3学分。

最终gpa是通过添加每门课程的积分来计算的,然后

将所添加的数字除以学分总数。


例如:

假设学生在一学期内修了5门课程。其中他的
已经拿走了1 A,1 B,1 C,1 D和1 F.然后他的Gpa将被计算为



(12 + 9 + 6 + 3 + 0)/ 15

其中15是5门课程的学分总数。

取两个Gpa类实例。一个是int类型,其他类型应该是char类型的
。将标记作为输入,例如int类型和

学生成绩,例如char类型。根据上述方法计算并显示两个实例的Gpa



还为Gpa编写构造函数和析构函数。

示例输出:


在每门课程中输入学生的分数:


90

85

80

75

75

学生的Gpa是3.6

__________________________________


在每门课程中输入学生的成绩:


A

A

A

B

B

学生的Gpa是3.6

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

推荐答案

pe******@vupages.com 写道:

编写一个C ++程序来计算学生的GPA。你的程序

应该包含一个名为Gpa的类。该类应该有一个名为

result的数组作为其数据成员。


此数组用于获取每个课程中学生的分数/等级。

因此Gpa类的数据成员应该是Template类型。


您的程序应具有以下模板类的成员函数

T.


1:输入()

此功能将从
$ b中获取每个课程中的分数/成绩输入$ b用户。


2:cal_gpa()


此函数将根据
$ b计算学生的gpa $ b输入标记/等级。 gpa将根据

以下标准计算。


如果学生得分超过或等于80分或者取得A等级/>
a当然,他应该得到12分反对该课程。同样地,如果他获得超过或等于70分并且少于80分或者在一个课程中获得B等级,则需要获得9分。

当然。以下是描述各自评分政策的表格


等级标记积分

A> = 80 12

B> = 70 9

C> = 60 6

D> = 50 3

F< = 49 0


为每门课程提供3学分。

最终gpa是通过添加每门课程的积分来计算的,然后

除以总数增加的数量学分小时数。


例如:

假设学生在一个学期内修了5门课程。其中他的
已经拿走了1 A,1 B,1 C,1 D和1 F.然后他的Gpa将被计算为



(12 + 9 + 6 + 3 + 0)/ 15

其中15是5门课程的学分总数。

取两个Gpa类实例。一个是int类型,其他类型应该是char类型的
。将标记作为输入,例如int类型和

学生成绩,例如char类型。根据上述方法计算并显示两个实例的Gpa



还为Gpa编写构造函数和析构函数。


样本输出:


在每门课程中输入学生的分数:


$

85
80

75

75

学生的Gpa是3.6

__________________________________


在每门课程中输入学生的成绩:


A

A

A

B

B

学生的Gpa是3.6
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



什么是付款方式?


- J.

What''s the method of payment?

- J.


pe ****** @ vupages.com 写道:

编写一个C ++程序来计算学生的GPA。你的程序

应该包含一个名为Gpa的类。该类应该有一个名为

result的数组作为其数据成员。


[etc ...]
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.

[etc ...]




这个在新闻组的常见问题解答中解决:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.2



pe ****** @ vupages.com 写道:

编写一个C ++程序来计算学生的GPA。你的程序

应该包含一个名为Gpa的类。该类应该有一个名为

result的数组作为其数据成员。


此数组用于获取每个课程中学生的分数/等级。

因此Gpa类的数据成员应该是Template类型。


您的程序应具有以下模板类的成员函数

T.


1:输入()

此功能将从
$ b中获取每个课程中的分数/成绩输入$ b用户。


2:cal_gpa()


此函数将根据
$ b计算学生的gpa $ b输入标记/等级。 gpa将根据

以下标准计算。


如果学生得分超过或等于80分或者取得A等级/>
a当然,他应该得到12分反对该课程。同样地,如果他获得超过或等于70分并且少于80分或者在一个课程中获得B等级,则需要获得9分。

当然。以下是描述各自评分政策的表格


等级标记积分

A> = 80 12

B> = 70 9

C> = 60 6

D> = 50 3

F< = 49 0


为每门课程提供3学分。

最终gpa是通过添加每门课程的积分来计算的,然后

除以总数增加的数量学分小时数。


例如:

假设学生在一个学期内修了5门课程。其中他的
已经拿走了1 A,1 B,1 C,1 D和1 F.然后他的Gpa将被计算为



(12 + 9 + 6 + 3 + 0)/ 15

其中15是5门课程的学分总数。

取两个Gpa类实例。一个是int类型,其他类型应该是char类型的
。将标记作为输入,例如int类型和

学生成绩,例如char类型。根据上述方法计算并显示两个实例的Gpa



还为Gpa编写构造函数和析构函数。


样本输出:


在每门课程中输入学生的分数:


$

85
80

75

75

学生的Gpa是3.6

__________________________________


在每门课程中输入学生的成绩:


A

A

A

B

B

学生的Gpa是3.6
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



显示你到目前为止所做的事情。

如果你打算让别人为你做功课,可以考虑使用

替代编程。

说真的:所有要求和预期结果都很清楚

详细,不是吗?

Show what you have done so far.
If you plan to have someone do the homework for you, consider an
alternative to programming.
Seriously: all the requirements and expected results are quite clear
and detailed, are they not?


这篇关于解决这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆