西南石油大学--学分绩点计算器(用C#编写,需要有.NET 2.0)

注意:需要有.net Framework 2.0才可以运行

.net Framework 2.0下载地址(如果你的电脑没有请在这儿下载):
http://www.gougou.com/search?search=.net%20Framework%202.0&id=0

学分绩点计算器下载地址:
http://download.csdn.net/source/973619
(要有CSDN账号才可以下载)

运行效果(示例而已):

效果

——————————————分割线下面是类关系图、代码———————-

这是类关系图:

类关系图

下面是代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using System;
using System.Collections.Generic;
using System.Text;

namespace 西南石油大学_学分绩点计算器
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("西南石油大学--学分绩点计算器");
Console.WriteLine();
Term thisTerm = new Term();
int NumOfCourses = GetInput.CourseNum(); //本学期课程数 for(int
for (i = 1; i <= NumOfCourses; i++)
{
Console.WriteLine();
Console.WriteLine("--------------开始录入第{0}门课程--------------", i);
Console.WriteLine("第{0}门课程有几个学分?", i);
double credit = GetInput.GetCredit();
Console.WriteLine("第{0}门课程考了多少分?", i);
double score = GetInput.GetCredit();
Course OneCourse = new Course(credit, score);
thisTerm.AddOneCourse(OneCourse);
Console.WriteLine("--------------第{0}门课程录入完毕--------------", i);
Console.WriteLine();
}

Console.WriteLine("最后学分绩点是:" + thisTerm.GetFinalJIDIAN());
Console.WriteLine("欢迎访问我的博客:http://blog.csdn.net/cuipengfei1");
Console.Read();
System.Diagnostics.Process.Start("http://blog.csdn.net/cuipengfei1");
}
}

class GetInput
{
public static int CourseNum()
{
Console.WriteLine("本学期一共有几门必修课程?(注意,是必修课程哦)");
string num = Console.ReadLine();
int NUM;
int.TryParse(num, out NUM);
return NUM;
}

public static double
GetCredit()
{
string credit = Console.ReadLine();
double CREDIT;
double.TryParse(credit, out CREDIT);
return CREDIT;
}
}

class Course //一门课程
{
private double credit; //学分 private double score;//分数 public double Credit//学分
{
get
{
return credit;
}

set
{
credit = value;
}
}

public double Score //分数
{
get { return score; }

set { score = value; }
}

public Course(double
_credit, double _score) //构造
{
credit = _credit;
score = _score;
}

public double
GetJIDIAN() //本门绩点
{
double jidian;
jidian = ((score - 60) / 10) + 1;
return jidian;
}
}

class Term //本学期
{
List<Course> AllCourse = new List<Course>();

public void AddOneCourse(Course course)
{
AllCourse.Add(course);
}

public
double GetFinalJIDIAN()
{
double totalCredit = 0;
double totalJIDIAN = 0;
foreach
(Course oneCourse in AllCourse)
{
totalCredit += oneCourse.Credit;
totalJIDIAN
+= oneCourse.GetJIDIAN() * oneCourse.Credit;
}

return totalJIDIAN / totalCredit;
}
}
}

PS:什么时候可以查分啊?