学分计算器是一款可以帮助在校大学生计算学分与绩点的计算工具,它是由吾爱破解论坛网页分享提供的,学分绩点是以学分与绩点作为衡量学生学习的量与质的计算单位,使用本软件就能够根据你的课程学分和成绩计算出你的学分绩点。欢迎下载使用。
国内大部分高校通用的计算方法是:绩点=分数/10-5,学分绩点=学分×绩点=学分×(分数/10-5)
每科的课程学分绩点=课程学分×课程权重系数×课程绩点
标准计算方法是将大学成绩的加权平均数乘以4,再除以100。比较常见的方法还有把各科成绩按等级乘以学分求和再以总学分除之。
本程序基于.NET 4.0制作,可以计算课程学分以及达标所需学分
课程数据存于txt文件
types.txt用于存放课程类别,课程类别.txt用于存放各类别的课程数据,格式:课程名+空格+学分(实验学分) tips:实验学分可空
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace PointCalc
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public struct Course
{
public string name;
public double point;
public double? point2;
public override string ToString()
{
return point2 == null ? name + " " + point : name + " " + point + "(" + point2 + ")";
}
}
double allPoint = 0;
double allPoint2 = 0;
List<Course> courses = new List<Course>();
FileStream fs;
StreamReader sr;
string content;
private void Form1_Load(object sender, EventArgs e)
{
fs = new FileStream("types.txt", FileMode.OpenOrCreate, FileAccess.Read);
sr = new StreamReader(fs, Encoding.Default);
content = sr.ReadLine();
while (content != null)
{
comboBox1.Items.Add(content);
content = sr.ReadLine();
}
sr.Close();
fs.Close();
if (comboBox1.Items.Count != 0)
comboBox1.SelectedIndex = 0;
toolStripStatusLabel1.Text = "";
}
private void checkBox_CheckedChanged(object sender, EventArgs e)
{
content = (sender as CheckBox).Text;
int index = int.Parse(content.Substring(0, content.IndexOf('.'))) - 1;
if ((sender as CheckBox).Checked)
{
allPoint += courses[index].point;
if (courses[index].point2 != null)
allPoint2 += (double)courses[index].point2;
}
else
{
allPoint -= courses[index].point;
if (courses[index].point2 != null)
allPoint2 -= (double)courses[index].point2;
}
Updata();
}
private void Updata()
{
label1.Text = "当前学分:" + allPoint.ToString("f1");
label2.Text = "当前括号学分:" + allPoint2.ToString("f1");
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
label1.Text = "当前学分:0";
label2.Text = "当前括号学分:0";
courses.Clear();
fs = new FileStream(comboBox1.SelectedItem.ToString() + ".txt", FileMode.Open, FileAccess.Read);
sr = new StreamReader(fs, Encoding.Default);
content = sr.ReadLine();
while (content != null)
{
string[] infos = content.Split(' ');
Course course = new Course();
course.name = infos[0];
if (infos[1].Contains('('))
{
course.point = double.Parse(infos[1].Substring(0, infos[1].IndexOf('(')));
var temp = infos[1].Substring(infos[1].IndexOf('('));
course.point2 = double.Parse(temp.Substring(1, temp.Length - 2));
}
else
{
course.point = int.Parse(infos[1]);
}
courses.Add(course);
content = sr.ReadLine();
}
sr.Close();
fs.Close();
RefreshPanel();
toolStripStatusLabel1.Text = "";
}
private void RefreshPanel()
{
flowLayoutPanel1.Controls.Clear();
for (int i = 0; i < courses.Count; ++i)
{
AddCheckBox(courses[i], i);
}
}
private void AddCheckBox(Course course, int i)
{
CheckBox checkbox = new CheckBox();
checkbox.Text = i + 1 + "." + course.ToString();
checkbox.Size = new Size(210, 16);
checkbox.CheckedChanged += checkBox_CheckedChanged;
checkbox.CheckedChanged += Calc;
checkbox.ContextMenuStrip = contextMenuStrip1;
this.flowLayoutPanel1.Controls.Add(checkbox);
}
private void button1_Click(object sender, EventArgs e)
{
string newType;
Form2 form2 = new Form2();
if (form2.ShowDialog() != DialogResult.OK)
{
return;
}
newType = form2.result;
fs = new FileStream("types.txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
sw.WriteLine(newType);
comboBox1.Items.Add(newType);
sw.Close();
fs.Close();
fs = new FileStream(newType + ".txt", FileMode.Create, FileAccess.Write);
fs.Close();
comboBox1.SelectedIndex = comboBox1.Items.Count - 1;
}
private void button3_Click(object sender, EventArgs e)
{
Course newCourse;
Form3 form3 = new Form3();
if (form3.ShowDialog() != DialogResult.OK)
{
return;
}
newCourse = form3.course;
fs = new FileStream(comboBox1.SelectedItem.ToString() + ".txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
sw.WriteLine(newCourse.ToString());
sw.Close();
fs.Close();
AddCheckBox(newCourse, courses.Count);
courses.Add(newCourse);
}
private void button2_Click(object sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show("确定删除?", "删除", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dialogResult != DialogResult.OK)
return;
File.Delete(comboBox1.SelectedItem.ToString() + ".txt");
int oldIndex = comboBox1.SelectedIndex;
comboBox1.Items.RemoveAt(comboBox1.SelectedIndex);
fs = new FileStream("types.txt", FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
foreach (var item in comboBox1.Items)
{
sw.WriteLine(item.ToString());
}
sw.Close();
fs.Close();
comboBox1.SelectedIndex = oldIndex - 1;
}
private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
{
content = (((sender as ToolStripMenuItem).GetCurrentParent() as ContextMenuStrip).SourceControl as CheckBox).Text;
courses.RemoveAt(int.Parse(content.Substring(0, content.IndexOf('.'))) - 1);
fs = new FileStream(comboBox1.SelectedItem.ToString() + ".txt", FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
foreach (var item in courses)
{
sw.WriteLine(item.ToString());
}
sw.Close();
fs.Close();
RefreshPanel();
}
private void Calc(object sender, EventArgs e)
{
double needPoint = 0;
double needPoint2 = 0;
if (!string.IsNullOrEmpty(textBox1.Text))
{
double goalPoint = double.Parse(textBox1.Text);
if (goalPoint > allPoint)
needPoint = goalPoint - allPoint;
}
else
return;
if (!string.IsNullOrEmpty(textBox1.Text))
{
double goalPoint2 = double.Parse(textBox2.Text);
if (goalPoint2 > allPoint2)
needPoint2 = goalPoint2 - allPoint2;
}
if (needPoint == 0 && needPoint2 == 0)
{
toolStripStatusLabel1.Text = string.Format("学分已足够!");
toolStripStatusLabel1.ForeColor = Color.Green;
}
else
{
toolStripStatusLabel1.Text = string.Format("距离目标学分还差:{0:N1}({1:N1})", needPoint, needPoint2);
toolStripStatusLabel1.ForeColor = Color.Red;
}
}
}
}