资源描述
JAVA程序设计
学院:
班级:
学号:
姓名:
目录
1 项目研究开发得背景及意义 2
1、1 本课题设计学术价值、理论意义与实践意义 2
1、2 本课题设计拟研究得主要问题 2
1、3重点与难点 3
1、4 研究方法、预期效益 3
1、5 本项目创新点与特色 3
2 需求分析 3
2、1 开发背景 3
2、2 项目目标 4
2、3 运行环境 4
3 技术路线及关键技术 7
3、1系统总体功能图 7
3、2学生成绩管理系统得功能模块简介: 10
3、3 系统运用得主要技术: 23
3、4数据库设计 24
3、5连接数据库 27
4 测试报告及系统评价 28
4、1 系统简介: 28
4、2 系统特色及缺点: 28
5 个人感受及收获 37
6大作业总结 37
1 项目研究开发得背景及意义
1、1 本课题设计学术价值、理论意义与实践意义
现在得社会知识经济在世界经济发展得地位越来越高,国家综合国力与国际竞争能力越来越取决于教育发展,科学技术与知识创新得水平,教育在经济与社会发展过程中将呈现出越来越突出得重要作用。学生成绩管理系统就是一个教育单位不可缺少得部分,它得内容对于学校得决策者与管理者来说都至关重要,所以学生成绩管理系统应该能够为用户提供充足得信息与快捷得查询手段。但就是有些学校还就是使用传统人工得方式管理学生成绩,填写各种表格,这种管理方式存在着许多缺点,如:效率低,保密性差,另外所用其时间长,产生大量得文件与数据,这对于查找,更新与维护都带来了不少得困难。在此次大作业中,我综合java编程、SQL数据库与SQL查询语言来实现一个简单得学生成绩管理系统。
1、2 本课题设计拟研究得主要问题
一个完整得学生管理系统包括四个功能模板:
(1)基本信息管理:包括对学生、教师、课程、成绩信息进行查找、删除、修改与添加。
(2)课表查询:学生与教师都可以对自身得课表进行查询。
(3)统计功能:对学生单科成绩、总成绩、所有学生成绩得平均分进行统计,并作出相应得排名。
(4)图形界面,将学生单科成绩用柱形图表示出来,清晰简单地表示出成绩得分布情况。
1、3重点与难点
(1)界面要求美观,需熟练掌握利用java语言来布局。
(2)数据库多个表联系,利用视图或者存储过程,需熟练掌握数据库得操作。
(3)模糊查找与精确查找,在界面上要求两者兼容,数据库上要求联系紧密。
(4)统计功能,单科与总成绩要求进行统计。
(5)图形界面,系统主界面加入背景图片以及成绩统计时以不同颜色得柱形图形象表达。
1、4 研究方法、预期效益
本次课程设计属于很普遍得应用研究类,我只就是在大家做得基础上加上我自己得得想法以及设计。同时结合我们现在学生得成绩情况来进行设计。我采用得方法就是理论分析结合实际来进行研究得,通过学习经验来建立模型,在此基础上对学生成绩管理系统进行设计。这个系统将在12月下旬设计结束,界面美观,使用方便,功能较全得一个原型系统。此系统可以应用于落后得乡村得中小学教学管理。
1、5 本项目创新点与特色
(1)本系统采用java与数据库结合得方式开发,可以对大量得数据进行存储与操作。
(2)本系统使用java开发,具有跨平台特性。
(3)本系统功能俱全,具有学生、教师、课程得信息管理与多条件得成绩查询与课程查询,成绩统计与利用柱形图反应成绩分布。
(4)系统具有安全性,用户只能通过用户名与密码访问。同时设定三种用户:管理员、学生、教师。不同得用户权限不同。
2 需求分析
2、1 开发背景
当今时代就是飞速发展得信息时代,在各行各业中离不开信息处理,这正就是计算机被广泛应用于信息管理系统得环境。计算机得最大好处在于利用它能够进行信息管理、使用计算机进行信息控制,不仅提高了工作效率,而且大大得提高了其安全性、尤其对于复杂得信息管理,计算机能够充分发挥它得优越性、。
管理信息系统就是进行信息得采集、存储、加工、维护与使用得系统,它就是随着管理科学与技术科学得发展而形成得。学生成绩管理系统就是一个教育单位不可缺少得部分,它得内容对于学校得决策者与管理者来说都至关重要,所以学生成绩管理系统应该能够为用户提供充足得信息与快捷得查询手段,对学生来说可以轻松得查阅自己在校得成绩,个人信息与课表查询等,但就是一直以来在落后得乡村一些中小学人们都就是靠传统人工得方式管理学生成绩,这种管理方式存在着许多缺点,如:效率低,保密性差,另外时间一长,将产生大量得文件与数据,这对于查找、更新与维护都带来了不少得困难。
随着科学技术得不断提高,计算机科学日渐成熟,其强大得功能已为人们深刻认识,它已进入人类社会得各个领域并发挥着越来越重要得作用,作为计算机应用得一部分,使用计算机对学生成绩信息进行管理,有着手工管理所无法比拟得优点,例如:检索迅速、查找方便、可靠性高、存储量大、保密性好、寿命长、成本低等。这些优点能够极大地提高学生成绩管理得效率,也就是企业得科学化,正规化管理,与世界接轨得重要条件。因此,开发这样得一套成绩管理系统成为很有必要得事情。
学生成绩管理系统提供了比较全面得学生成绩管理管理功能,方便系统管理员对学生成绩等信息得添加、修改、删除、查询、统计等操作。
2、2 项目目标
(1)管理员能够实现对整个学生信息得添加、修改、删除、查询等操作。
(2)管理员能够实现对整个教师信息得添加、修改、删除、查询等操作。
(3)管理员能够实现对整个课程信息得添加、修改、删除、查询等操作。
(4)学生、教师、管理员对整个成绩得查询。
(5)教师、学生查询课表。
(6)系统对成绩具有统计计算得功能,将成绩情况用柱形图形象地表现出来,并对成绩进行排名,包括单科与总成绩。
(7)不同得角色不同得权限。
2、3 运行环境
学生成绩对运行环境没有很高得要求,而且可以跨平台运行,包括现有得linux与uniux等操作系统。
3 技术路线及关键技术
3、1系统总体功能图
(1)系统结构图
学生成绩管理系统
管理员
学生
老师
学生信息管理
教师信息管理
课程信息管理
成绩信息
管理
课程授课
管理
查询成绩
查询个人课表
查询成绩统计
查询成绩
查询教师课表
查询成绩统计
图3、1-系统总结构图
(2)系统流程图:在系统设计中,将用户分成三种权限,不同权限得用户,则访问得内容不同、控制得信息也不同,系统结构图如图3、1,系统流程图如图3、2。
开始
选择用户登录
输入用户名密码
正确
退出
结束
操作
Y
图3、2-系统流程图
(3)在系统结构图中,我们可以瞧到管理员对学生、课程、成绩、教师得基本信息有增删改除得功能,以下就是具体功能模块结构图:
学生信息管理
学生
信息添加
学生信息修改
学生信息查询
学生信息删除
图3、3-学生信息管理模块
教师信息管理
教师
信息添加
教师信息修改
教师信息查询
教师信息删除
图3、4-教师信息管理模块
课程信息管理
课程
信息添加
课程信息修改
课程信息查询
课程信息删除
图3、5-课程信息管理模块
成绩信息管理
成绩
信息添加
成绩信息修改
成绩信息查询
成绩信息删除
成绩统计
图3、6-成绩信息管理模块
3、2学生成绩管理系统得功能模块简介:
(1)基本信息管理(以学生为例)
if(obj==tianjia)//添加
{
Sno=tf_xuehao、getText()、trim();
Sname=tf_xingming、getText()、trim();
sex=tf_xingbie、getText()、trim();
age1=Integer、parseInt(tf_nianling、getText()、trim());
tel_no=tf_dianhua、getText()、trim();
classno=tf_banhao、getText()、trim();
addr=tf_dizhi、getText()、trim();
if(Sno、length()==0||Sname、length()==0||sex、length()==0||age1==0||Sno、length()==0||tel_no、length()==0||addr、length()==0||classno、length()==0)
{
JOptionPane、showMessageDialog(this,"请添加完整信息!","提示信息",JOptionPane、QUESTION_MESSAGE);
}
else
{
try
{
ps=con、prepareStatement("insert into student values(?,?,?,?,?,?,?)");
ps、setString(1, Sno);
ps、setString(2, Sname);
ps、setString(3, sex);
ps、setString(4, classno);
ps、setString(5, addr);
ps、setInt(6, age1);
ps、setString(7, tel_no);
JOptionPane、showMessageDialog(this,"确定添加吗?","提示信息",JOptionPane、QUESTION_MESSAGE);
tf_xuehao、setText("");
tf_xingming、setText("");
tf_xingbie、setText("");
tf_nianling、setText("");
tf_dianhua、setText("");
tf_dizhi、setText("");
tf_banhao、setText("");
rs=ps、executeQuery();
}
catch(SQLException sql)
{
JOptionPane、showMessageDialog(this,"添加成功!","提示信息",JOptionPane、QUESTION_MESSAGE);
}
}
}
if(obj==xiugai)//修改
{
String no=shuru、getText()、trim();
Sno=tf_xuehao、getText()、trim();
Sname=tf_xingming、getText()、trim();
sex=tf_xingbie、getText()、trim();
age1=Integer、parseInt(tf_nianling、getText()、trim());
tel_no=tf_dianhua、getText()、trim();
addr=tf_dizhi、getText()、trim();
classno=tf_banhao、getText()、trim();
try
{
ps=con、prepareStatement("update student set Sno=?,Sname=?,sex=?,classno=?,addr=?,age=?,tel_no=? where Sno=?");
ps、setString(1, Sno);
ps、setString(2, Sname);
ps、setString(3,sex);
ps、setString(4,classno);
ps、setString(5,addr);
ps、setInt(6,age1);
ps、setString(7,tel_no);
ps、setString(8,no);
JOptionPane、showMessageDialog(this,"确定修改吗?","提示信息",JOptionPane、QUESTION_MESSAGE);
tf_xuehao、setText("");
tf_xingming、setText("");
tf_xingbie、setText("");
tf_banhao、setText("");
tf_dizhi、setText("");
tf_nianling、setText("");
tf_dianhua、setText("");
JOptionPane、showMessageDialog(this,"修改成功!","提示信息",JOptionPane、INFORMATION_MESSAGE);
rs=ps、executeQuery();
rs、next();
}
catch(SQLException sql)
{
JOptionPane、showMessageDialog((ponent)null,sql、getMessage(),"提示信息",JOptionPane、QUESTION_MESSAGE);
}
}
if(obj==shanchu)//删除
{
try
{
String no=shuru、getText()、trim();
ps=con、prepareStatement("delete from student where Sno=?");
ps、setString(1,no);
JOptionPane、showMessageDialog(this,"确定删除吗?","提示信息",JOptionPane、QUESTION_MESSAGE);
tf_xuehao、setText("");
tf_nianling、setText("");
tf_xingming、setText("");
tf_dianhua、setText("");
tf_dizhi、setText("");
tf_xingbie、setText("");
tf_banhao、setText("");
rs=ps、executeQuery();
JOptionPane、showMessageDialog(this,"删除成功!","提示信息",JOptionPane、INFORMATION_MESSAGE);
}
catch(SQLException sqlex)
{
sqlex、getMessage();
}
}
if(obj==qingkong)//清空
{
shuru、setText("");
tf_xuehao、setText("");
tf_nianling、setText("");
tf_xingming、setText("");
tf_dianhua、setText("");
tf_dizhi、setText("");
tf_xingbie、setText("");
tf_banhao、setText("");
}
}}
主要功能:
添加、删除、修改、查询学生基本信息。
实现目得:
对于每个新得学年都有大量得学生入录,对学生信息得添加就是必不可少得。同时,在管理员得日常工作过程中,难免不出现错误。所以对其信息修改功能也就是必不可少得,删除则就是在学生开除学籍时可以使用。同时课程、教师、成绩信息与学生信息操作就是相同得。
(2) 成绩统计:
//统计各科平均分
public String SubjectAvg(String subject){
String s = null;
float t = 0 ;
this、Connect();
if(subject、equals("计算机网络"))
{
s = "select avg(grade) from transcript where Cno=003125";
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
while(rs、next())
{
t = rs、getFloat(1);
}
}catch(Exception e){
e、printStackTrace();
}
}
if(subject、equals("数据库系统原理"))
{
s = "select avg(grade) from transcript where Cno=003126";
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
while(rs、next())
{
t = rs、getFloat(1);
}
}catch(Exception e){
e、printStackTrace();
}
}
if(subject、equals("多媒体技术基础"))
{
s = "select avg(grade) from transcript where Cno=003127";
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
while(rs、next())
{
t = rs、getFloat(1);
}
}catch(Exception e){
e、printStackTrace();
}
}
if(subject、equals("概率论与数理统计"))
{
s = "select avg(grade) from transcript where Cno=003128";
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
while(rs、next())
{
t = rs、getFloat(1);
}
}catch(Exception e){
e、printStackTrace();
}
}
return Float、toString(t);
}
//总分平均分统计
public String allAvg(){
float sum = 0;
int count = 0;
// st = this、Connect()、prepareStatement(sql);
String s = "select sum(grade) as total from transcript";
System、out、println("s="+s);
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
System、out、println("rs="+rs);
if(rs、next())
{
sum = rs、getFloat("total");
System、out、println("sum="+sum);
}
rs = null;
s = "select sum(grade) from transcript where Cno=001325";
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
if(rs、next())
{
sum =sum + rs、getFloat(1);
}
rs = null;
s = "select sum(grade) from transcript where Cno=001326";
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
if(rs、next())
{
sum =sum + rs、getFloat(1);
}
rs = null;
s = "select sum(grade) from transcript where Cno=001328";
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
if(rs、next())
{
sum =sum + rs、getFloat(1);
}
rs = null;
s = "select count(distinct Sno) from transcript";
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
if(rs、next())
{
count = rs、getInt(1);
}
}catch(Exception e){
e、printStackTrace();
}
if(count == 0)
return "0";
else
{
sum = sum/count;
return Float、toString(sum);
}
}
//获得各科得分数段人数
public int gethigh(String subject,int grade){
//总得人数
int num = 0;
String s = null;
this、Connect();
if(subject、equals("计算机网络"))
{
if(grade == 60)
s = "select count(sno) from transcript a,course b where grade <60 and ao=bo and Cname='计算机网络'";
if(grade == 70)
s = "select count(sno) from transcript a,course b where grade <70 and grade >=60 and ao=bo and Cname='计算机网络'";
if(grade == 80)
s = "select count(sno) from transcript a,course b where grade <80 and grade >=70 and ao=bo and Cname='计算机网络'";
if(grade == 90)
s = "select count(sno) from transcript a,course b where grade <90 and grade >=80 and ao=bo and Cname='计算机网络'";
if(grade == 100)
s = "select count(sno) from transcript a,course b where grade <100 and grade >=90 and ao=bo and Cname='计算机网络'";
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
while(rs、next())
{
num= rs、getInt(1);
}
}catch(Exception e){
e、printStackTrace();
}
}
if(subject、equals("数据库系统原理"))
{
if(grade == 60)
s = "select count(sno) from transcript a,course b where grade <60 and ao=bo and Cname='数据库系统原理'";
if(grade == 70)
s = "select count(sno) from transcript a,course b where grade <70 and grade >=60 and ao=bo and Cname='数据库系统原理'";
if(grade == 80)
s = "select count(sno) from transcript a,course b where grade <80 and grade >=70 and ao=bo and Cname='数据库系统原理'";
if(grade == 90)
s = "select count(sno) from transcript a,course b where grade <90and grade >=80 and ao=bo and Cname='数据库系统原理'";
if(grade == 100)
s = "select count(sno) from transcript a,course b where grade <100 and grade >=90 and ao=bo and Cname='数据库系统原理'";
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
while(rs、next())
{
num= rs、getInt(1);
}
}catch(Exception e){
e、printStackTrace();
}
}
if(subject、equals("多媒体技术基础"))
{
if(grade == 60)
s = "select count(sno) from transcript a,course b where grade <60 and ao=bo and Cname='多媒体技术基础'";
if(grade == 70)
s = "select count(sno) from transcript a,course b where grade <70 and grade >=60 and ao=bo and Cname='多媒体技术基础'";
if(grade == 80)
s = "select count(sno) from transcript a,course b where grade <80 and grade >=70 and ao=bo and Cname='多媒体技术基础'";
if(grade == 90)
s = "select count(sno) from transcript a,course b where grade <90 and grade >=80 and ao=bo and Cname='多媒体技术基础'";
if(grade == 100)
s = "select count(sno) from transcript a,course b where grade <100 and grade >=90 and ao=bo and Cname='多媒体技术基础'";
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
while(rs、next())
{
num= rs、getInt(1);
}
}catch(Exception e){
e、printStackTrace();
}
}
if(subject、equals("概率论与数理统计"))
{
if(grade == 60)
s = "select count(sno) from transcript a,course b where grade <60 and ao=bo and Cname='概率论与数理统计'";
if(grade == 70)
s = "select count(sno) from transcript a,course b where grade <70 and grade >=60 and ao=bo and Cname='概率论与数理统计'";
if(grade == 80)
s = "select count(sno) from transcript a,course b where grade <80 and grade >=70 and ao=bo and Cname='概率论与数理统计'";
if(grade == 90)
s = "select count(sno) from transcript a,course b where grade <90 and grade >=80 and ao=bo and Cname='概率论与数理统计'";
if(grade == 100)
s = "select count(sno) from transcript a,course b where grade <100 and grade >=90 and ao=bo and Cname='概率论与数理统计'";
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
while(rs、next())
{
num= rs、getInt(1);
}
}catch(Exception e){
e、printStackTrace();
}
}
return num;
}
//获得总得人数
public int count(){
int count = 0;
String s = "select count(distinct Sno) from transcript";
this、Connect();
try{
st = this、Connect()、prepareStatement(s);
rs = st、executeQuery();
while(rs、next())
{
count = rs、getInt(1);
}
}catch(Exception e){
e、printStackTrace();
}
return count; }
主要功能:
对各科成绩与总成绩进行统计,算出它得平均分。同时显示每科小于60或者大于60分得同学成绩列表。 并且用直方图将每个分数段得学生数量形象地表示出来。
主要目得:
在实际得学生成绩管理过程中,计算平均分就是很重要得,便于学校与老师对学生总体成绩得了解。从而不断发现新得教学方法来提高总体学生得学习成绩。同时成绩分布图给予协助。
(3) 管理员界面及主函数入口模块:MainAndGUI、java
//主界面(管理员界面)
import javax、swing、*
import java、awt、*;
import java、awt、event、*;
import java、text、DateFormat;
import java、util、Date;
public class Grade extends JFrame {
private static final long serialVersionUID = 1L;
//定义主框架
private JFrame frame = new JFrame("学生成绩管理系统");
//定义菜单栏
private JMenuBar Bar = new JMenuBar();
//定义菜单
private JToolBar statusBar=new JToolBar(); //状态栏status
private JMenu JMedit = new JMenu("成绩信息");
private JMenu JMcount = new JMenu("统计");
private JMenu JMhelp = new JMenu("帮助");
private JMenu JMinfor= new JMenu("基本信息管理");
//定义菜单项
private JMenuItem JMIinput = new JMenuItem("信息添加");
private JMenuItem JMImodify = new JMenuItem("成绩查询");
private JMenuItem JMIall = new JMenuItem("成绩统计");
private JMenuItem JMIgraphic
展开阅读全文