版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、学生成绩管理系统课程设计实验报告题目学生成绩管理系统学院数学与信息工程学院专业计算机科学与技术班级同组成员编写日期一、 课程设计目的做这个小的学生成绩管理系统来加深对JAVA所学知识的巩固,以及学习JAVA与数据库的连接和JAVA的GUI图形界面。二、 需求分析此系统实现如下系统功能:(1)使得学生的成绩管理工作更加清晰、条理化、自动化。(2)通过用户名和密码登录系统,查询学生基本资料,学生所学课程成绩,等功能。容易地完成学生信息的查询操作。(3)设计人机友好界面,功能安排合理,操作使用方便,并且进一步考虑系统在安全性,完整性,并发控制,备份和恢复等方面的功能要求。三、系统模块设计用户登录此系
2、统可分为2个模块,教师管理模块和学生操作模块,期中教师又包括学生信息输入与学生成绩录入等;学生模块则包括学生成绩查询与学生信息录入查询操作等。系统流程图:学生学生信息查询学生成绩查询教师学生成绩录入学生信息录入四、数据库1、学生表:FieldTypeNullKeyCommentIDVarchar(10)PRI用户名(学号)PwdVarchar(10)密码NameChar(10)姓名SexChar(10)性别ClassChar(10)班级CollageChar(10)学院2、教师表FieldTypeNullKeyCommentIDVarchar(10)PRI用户名PwdVarchar(10)密码
3、3、成绩表FieldTypeNullKeyCommentSidchar(10)PRI学号计算机网络char(10)课程Linux操作系统char(10)课程计算机专业英语char(10)课程计算机信息技术char(10)课程Java程序设计char(10)课程数据库应用实训char(10)课程高等数学char(10)课程XMLchar(10)课程五、E-R图六、心得体会通过本次课程设计,成功的完成了这个小型简单的系统的设计,在整个设计过程中我对JAVA使用和它强大的作用有了一个更深刻的认识,尽管这个系统很简单,但是它让我综合运用了这个学期所学的JAVA的很多内容,在此基础上,对JAVA的基础知
4、识得到了更好的巩固。在制作的过程中我也学到很多思想:首先,要学会统筹全局,合理规划,例如在制作整个框架的时候提前就要做全面考虑,要把整个结构图画出来,并且要对数据库表里的东西做全面规划。同时在编写程序的时候也要想好先实现什么功能,再实现什么功能,这样做出来的东西才有条理性,更容易实现和理解。其次,要细心仔细。Java程序虽然容易理解,但在写的过程中一不留心就会出现错误。当然出错是在所难免的,与性质有关的错误可以经过思考讨论后进行改正,但如果粗心大意,出现输入上的错误就很难发现和修改,会耽误很多时间。我认为最大的收获是提高了自己的动手能力。在平时的上机中大多数是根据书上的思想和布局来写程序的。这
5、次的课程设计要自己思考自己写,考虑的东西比平时上机考虑的要多的多。在整个设计过程中写代码不是最难的,最难的是构思和布局。这次课程设计也是一次很好的实践活动,让我们体会到了java的神奇作用。附录:源代码1、用户登录界面importjava.awt.*;importjavax.swing.*;importimportjava.sql.*;publicclassSystemsextendsJFrameimplementsActionListenerstaticSystemsss;JPanelpanel=newJPanel();JLabellabel1=newJLabel("输入姓名:&q
6、uot;);JTextFieldname=newJTextField();JLabellabel2=newJLabel("密码:");JPasswordFieldpwd=newJPasswordField();JButtonEnter=newJButton("登录");JButtonExit=newJButton("退出");Stringurl="E:mysqlTM1.jpg"ButtonGroupbgp=newButtonGroup();JRadioButtonstu=newJRadioButton("
7、学生");JRadioButtontch=newJRadioButton("教师");publicSystems()super("登录系统");this.setResizable(false);JLabelimg=newJLabel(newImageIcon(url);img.setBounds(0,0,500,125);panel.add(img);stu.setBounds(165,210,70,20);tch.setBounds(265,210,70,20);bgp.add(stu);bgp.add(tch);panel.add(stu)
8、;panel.add(tch);Enter.setBounds(150,250,80,20);Exit.setBounds(270,250,80,20);Enter.addActionListener(this);Exit.addActionListener(this);panel.add(Enter);panel.add(Exit);panel.setLayout(null);this.add(panel);label1.setBounds(135,130,100,25);panel.add(label1);name.setBounds(265,130,100,25);panel.add(n
9、ame);label2.setBounds(135,165,100,25);panel.add(label2);pwd.setBounds(265,165,100,25);panel.add(pwd);this.setBounds(100,100,500,350);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);publicvoidactionPerformed(ActionEvente)if(e.getSource()=Enter)Stringusername,password;usernam
10、e=name.getText();password=newString(pwd.getPassword();trycatch(ClassNotFoundExceptionce)JOptionPane.showMessageDialog(ss,ce.getMessage();if(stu.isSelected()tryConnectioncon=DriverManager.getConnection("jdbc:odbc:shujuku","sa","");Statementstmt=con.createStatement();Resu
11、ltSetrs=stmt.executeQuery("select*fromSTU");while(rs.next()if(rs.getString("ID").equals(username)if(rs.getString("Pwd").equals(password)JOptionPane.showMessageDialog(ss,"登陆成功");Studentsstu=newStudents();elseJOptionPane.showMessageDialog(ss,"登录失败");rs
12、.close();stmt.close();catch(SQLExceptionse)JOptionPane.showMessageDialog(ss,se.getMessage();elseif(tch.isSelected()tryConnectioncon=DriverManager.getConnection("jdbc:odbc:shujuku","sa","");Statementstmt=con.createStatement();ResultSetrs=stmt.executeQuery("select*fr
13、omTCH");while(rs.next()if(rs.getString("ID").equals(username)if(rs.getString("Pwd").equals(password)JOptionPane.showMessageDialog(ss,"登陆成功");Teacherstch=newTeachers();elseJOptionPane.showMessageDialog(ss,"登录失败");catch(SQLExceptionse)JOptionPane.showMessag
14、eDialog(ss,se.getMessage();elseSystem.exit(0);publicstaticvoidmain(Stringargs)Systemssys=newSystems();2、学生登录界面:importjava.awt.*;importjavax.swing.*;importpublicclassStudentsextendsJFrameimplementsActionListenerJMenuBarjmb=newJMenuBar();JMenuMessage=newJMenu("信息");JMenuScore=newJMenu("
15、成绩");JMenuItemItem1=newJMenuItem("插入");JMenuItemItem2=newJMenuItem("查询");JMenuItemItem3=newJMenuItem("查询");publicStudents()super("学生界面");this.setSize(500,400);this.setVisible(true);this.setResizable(false);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS
16、E);this.setJMenuBar(jmb);jmb.add(Message);jmb.add(Score);Message.add(Item1);Message.add(Item2);Score.add(Item3);Item1.addActionListener(this);Item2.addActionListener(this);Item3.addActionListener(this);publicvoidactionPerformed(ActionEvente)if(e.getSource()=Item1)AddMsgad=newAddMsg();elseif(e.getSou
17、rce()=Item2)Serchser=newSerch();elseScoreso=newScore();publicstaticvoidmain(Stringargs)Studentsstu=newStudents();3、教师登录界面:importjava.awt.*;importjavax.swing.*;importpublicclassTeachersextendsJFrameimplementsActionListenerJMenuBarbar=newJMenuBar();JMenumenu1=newJMenu("信息");JMenumenu2=newJMe
18、nu("成绩");JMenuItemitem1=newJMenuItem("录入信息");JMenuItemitem2=newJMenuItem("录入成绩");JPaneljpl=newJPanel();publicTeachers()super("教师界面");this.setSize(500,300);this.setResizable(false);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.s
19、etJMenuBar(bar);this.add(jpl);jpl.setLayout(null);bar.add(menu1);bar.add(menu2);menu1.add(item1);menu2.add(item2);item1.addActionListener(this);item2.addActionListener(this);publicvoidactionPerformed(ActionEvente)if(e.getSource()=item1)AddMsgmsg=newAddMsg();elseAddscoreas=newAddscore();publicstaticv
20、oidmain(Stringargs)Teacherstch=newTeachers();4、学生用户添加界面:importjava.awt.*;importjavax.swing.*;importimportjava.sql.*;publicclassAddMsgextendsJFrameimplementsActionListenerstaticAddMsgs;/*添加学生信息控件*/JPaneljpl=newJPanel();JLabellabel1=newJLabel("添加基本信息",JLabel.CENTER);JLabellabel2=newJLabel(&q
21、uot;学号:",JLabel.CENTER);JLabellabel3=newJLabel("姓名:",JLabel.CENTER);JLabellabel4=newJLabel("性别:",JLabel.CENTER);JLabellabel5=newJLabel("班级:",JLabel.CENTER);JLabellabel6=newJLabel("学院:",JLabel.CENTER);JTextFieldnum=newJTextField(2);JTextFieldnam=newJTextFi
22、eld(4);ButtonGroupbgp=newButtonGroup();JRadioButtonman=newJRadioButton("男");JRadioButtonwomen=newJRadioButton("女");JTextFieldclas=newJTextField();JTextFieldscl=newJTextField();JButtonreset=newJButton("重置");JButtonaddmsg=newJButton("添加");publicAddMsg()super(&qu
23、ot;添加学生信息");this.setResizable(false);this.setSize(500,400);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.add(jpl);jpl.setLayout(null);addmsg.addActionListener(this);reset.addActionListener(this);/*插入面板*/label1.setBounds(100,20,300,20);jpl.add(label1);label2.setB
24、ounds(100,50,70,20);jpl.add(label2);num.setBounds(190,50,140,20);jpl.add(num);label3.setBounds(100,90,70,20);jpl.add(label3);nam.setBounds(190,90,140,20);jpl.add(nam);label4.setBounds(100,130,70,20);jpl.add(label4);man.setBounds(190,130,60,20);women.setBounds(270,130,60,20);jpl.add(man);jpl.add(wome
25、n);bgp.add(man);bgp.add(women);label5.setBounds(100,170,70,20);jpl.add(label5);clas.setBounds(190,170,140,20);jpl.add(clas);label6.setBounds(100,210,70,20);jpl.add(label6);scl.setBounds(190,210,140,20);jpl.add(scl);reset.setBounds(120,250,90,20);addmsg.setBounds(240,250,90,20);jpl.add(reset);jpl.add
26、(addmsg);publicvoidactionPerformed(ActionEvente)if(e.getSource()=addmsg)Stringsex;if(man.isSelected()sex="男"elsesex="女"trycatch(ClassNotFoundExceptionce)JOptionPane.showMessageDialog(s,ce.getMessage();tryConnectioncon=DriverManager.getConnection("jdbc:odbc:shujuku",&quo
27、t;sa","");Statementstmt=con.createStatement();Stringstr="insertintoSTU(ID,Pwd,Name,Sex,Class,Collage)values('"+num.getText()+"','"+"123','"+nam.getText()+"','"+sex+"','"+clas.getText()+"',
28、39;"+scl.getText()+"')"/inta=stmt.executeUpdate("insertintoSTU(ID,Pwd,Name,Sex,Class,inta=stmt.executeUpdate(str);if(a=1)JOptionPane.showMessageDialog(s,"已成功添加");elseJOptionPane.showMessageDialog(s,"添加失败");stmt.close();catch(SQLExceptionse)JOptionPane.show
29、MessageDialog(s,se.getMessage();elsenum.setText("");nam.setText("");clas.setText("");scl.setText("");num.requestFocus();publicstaticvoidmain(Stringargs)AddMsgamg=newAddMsg();5、学生成绩添加:importjava.awt.*;importjavax.swing.*;importimportjava.sql.*;publicclassAddsco
30、reextendsJFrameimplementsActionListenerstaticAddscoress;JLabellabel=newJLabel("学号:"),newJLabel("计算机网络:"),newJLabel("Linux操作系统:"),newJLabel("计算机专业英语:"),newJLabel("计算机信息技术基础:"),newJLabel("Java程序设计:"),newJLabel("数据库应用实训教程:"),newJLabe
31、l("高等数学:"),newJLabel("XML:");JTextFieldtxt=newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextField();JButtonadd=newJButton("添加");JButtonreset=newJButton("重置");JPaneljpl=newJP
32、anel();JLabeltitle=newJLabel("添加学生成绩",JLabel.CENTER);Fontf=newFont("黑体",Font.BOLD,16);ints=100;publicAddscore()super("添加学生信息");this.setResizable(false);this.setSize(500,600);this.setDefaultCloseOperation(EXIT_ON_CLOSE);this.setVisible(true);this.add(jpl);add.addActionLi
33、stener(this);reset.addActionListener(this);jpl.setLayout(null);title.setBounds(150,40,200,20);title.setFont(f);title.setForeground(Color.red);jpl.setBackground(Color.LIGHT_GRAY);jpl.add(title);for(inti=0;i<label.length;i+)labeli.setBounds(100,s,140,20);jpl.add(labeli);txti.setBounds(260,s,140,20)
34、;jpl.add(txti);s=s+40;add.setBounds(150,s,80,20);reset.setBounds(250,s,80,20);jpl.add(add);jpl.add(reset);publicvoidactionPerformed(ActionEvente)if(e.getSource()=add)trycatch(ClassNotFoundExceptionce)JOptionPane.showMessageDialog(ss,ce.getMessage();tryConnectioncon=DriverManager.getConnection("
35、jdbc:odbc:shujuku","sa","");Statementstmt=con.createStatement();inta=stmt.executeUpdate("insertinto计算机系成绩(SID,计算机网络,Linux操作系统,计算机专业英语,计算机信息技术基础,Java程序设计,数据库应用实训教程,高等数学,Xml)values('"+txt0.getText()+"','"+txt1.getText()+"','"+t
36、xt2.getText()+"','"+txt3.getText()+"','"+txt4.getText()+"','"+txt5.getText()+"','"+txt6.getText()+"','"+txt7.getText()+"','"+txt8.getText()+"')");if(a=1)JOptionPane.showMessageDi
37、alog(ss,"添加成功");elseJOptionPane.showMessageDialog(ss,"添加失败");catch(SQLExceptionse)JOptionPane.showMessageDialog(ss,se.getMessage();elsefor(inti=0;i<txt.length;i+)txti.setText("");txt0.requestFocus();publicstaticvoidmain(Stringargs)Addscoreas=newAddscore();6、学生信息查询:im
38、portjava.awt.*;importjavax.swing.*;importimportjava.sql.*;publicclassSerchextendsJFrameimplementsActionListener/*查询学生信息控件*/staticSerchs;JPaneljpl=newJPanel();JLabelSCH=newJLabel("查询学生信息",JLabel.CENTER);JLabellabel1=newJLabel("请输入学号:",JLabel.CENTER);JButtonserch=newJButton("查
39、询");JLabellabel2=newJLabel("姓名:",JLabel.CENTER);JLabellabel3=newJLabel("班级:",JLabel.CENTER);JLabellabel4=newJLabel("学校:",JLabel.CENTER);JLabellabel5=newJLabel("性别:",JLabel.CENTER);ButtonGroupbgp=newButtonGroup();JRadioButtonman=newJRadioButton("男&quo
40、t;);JRadioButtonwomen=newJRadioButton("女");JTextFieldnum=newJTextField();JTextFieldnam=newJTextField();JTextFieldclas=newJTextField();JTextFieldscl=newJTextField();JButtonreset=newJButton("重置");publicSerch()this.setSize(500,400);this.setVisible(true);this.setResizable(false);this
41、.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.add(jpl);jpl.setLayout(null);serch.addActionListener(this);reset.addActionListener(this);/*查询面板*/SCH.setBounds(100,20,300,20);jpl.add(SCH);label1.setBounds(100,60,100,20);jpl.add(label1);num.setBounds(220,60,140,20);jpl.add(num);serch.setBounds(12
42、0,100,90,20);reset.setBounds(260,100,90,20);jpl.add(serch);jpl.add(reset);label2.setBounds(100,140,70,20);jpl.add(label2);nam.setBounds(190,140,140,20);jpl.add(nam);label5.setBounds(100,180,70,20);jpl.add(label5);man.setBounds(205,180,60,20);women.setBounds(285,180,60,20);bgp.add(man);bgp.add(women)
43、;jpl.add(man);jpl.add(women);label3.setBounds(100,220,70,20);jpl.add(label3);clas.setBounds(190,220,140,20);jpl.add(clas);label4.setBounds(100,260,70,20);jpl.add(label4);scl.setBounds(190,260,140,20);jpl.add(scl);publicvoidactionPerformed(ActionEvente)Stringid=num.getText();if(e.getSource()=serch)tr
44、ycatch(ClassNotFoundExceptionce)JOptionPane.showMessageDialog(s,ce.getMessage();tryConnectioncon=DriverManager.getConnection("jdbc:odbc:shujuku","sa","");Statementstmt=con.createStatement();ResultSetrs=stmt.executeQuery("select*fromSTUwhereID='"+id+"&
45、#39;");while(rs.next()nam.setText(rs.getString("Name");if(rs.getString("Sex").equals("男")man.setSelected(true);elsewomen.setSelected(true);clas.setText(rs.getString("Class");scl.setText(rs.getString("Collage");catch(SQLExceptionse)JOptionPane.sh
46、owMessageDialog(s,se.getMessage();publicstaticvoidmain(Stringargs)Serchsch=newSerch();7、学生成绩查询importjava.awt.*;importjavax.swing.*;importimportimportjava.sql.*;publicclassScoreextendsJFrameimplementsActionListenerstaticScores;JLabeltitle=newJLabel("查询成绩",JLabel.CENTER);Fontf=newFont("
47、楷体",Font.BOLD+Font.ITALIC,16);JPaneljpl=newJPanel();JLabellabel1=newJLabel("请输入学号:",JLabel.CENTER);JTextFieldnum=newJTextField();JButtonserch=newJButton("查询成绩");JButtonreset=newJButton("重置");JLabellabel2=newJLabel("计算机网络:",JLabel.LEFT);JLabellabel3=newJLa
48、bel("Linux操作系统:",JLabel.LEFT);JLabellabel4=newJLabel("计算机专业英语:",JLabel.LEFT);JLabellabel5=newJLabel("计算机信息技术基础:",JLabel.LEFT);JLabellabel6=newJLabel("Java程序设计:",JLabel.LEFT);JLabellabel7=newJLabel("数据库:",JLabel.LEFT);JLabellabel8=newJLabel("高等数学:",JLabel.LEFT);JLabellabel9=newJLabel("XML:",JLabel.LEFT);JTextFieldtxt=newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextField(),newJTextField();staticintp=140;publicScore()super("查询分数");this.setResizable(f
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2030知识管理系统子系统行业市场供需调研投资评估规划研究报告
- 2025-2030甘肃新能源卡车行业市场供需分析及投资评估规划分析研究报告
- 2026年电工安全操作考强化训练带答案详解(新)
- 2026年新入职护士知识考核模考模拟试题(培优B卷)附答案详解
- 汽车租赁车辆管理制度
- 2026年初级经济师之初级金融专业预测试题含完整答案详解【夺冠系列】
- 2026年无人机驾驶证通关训练试卷附答案详解AB卷
- 2026新疆阿拉尔市拓华国有资产经营有限责任公司招(竞)聘高层管理人员5人备考题库及参考答案详解1套
- 2026中国人民财产保险股份有限公司山亭支公司招聘10人备考题库含答案详解(夺分金卷)
- 2026年软件项目管理复习模考模拟试题含答案详解(突破训练)
- 房屋抵押个人借款协议样式
- 2023年新高考河北卷政治高考真题解析(参考版)
- JC/T2041-2020 聚氨酯灌浆材料
- 国内外注塑模具发展现状的调查研究
- 基础设施老化问题与对策
- 部编人教版四年级下册小学数学全册课时练(一课一练)
- 社区零星维修工程投标方案(技术标)
- 碳捕集、利用与封存技术
- 城轨列车自动控制系统-ATO子系统
- 抑郁病诊断证明书
- 典必殊策划书0913-课件
评论
0/150
提交评论