




已阅读5页,还剩27页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
学生信息管理系统32Java程序设计结课报告目 录第1章 学生信息管理系统简介31.1 系统功能31.2 系统引用例子3第2章 表的设计42.1 系统数据库表结构:4第3章 连接数据库的实现5第4章 系统详细设计64.1系统登录模块设计64.2系统主界面详细设计104.2.1管理员操作模块104.2.2 教师操作模块124.2.3 学生操作模块14第5章 系统运行与测试165.1 管理员登录165.2 教师登录175.3 学生登录22答辩记录31成绩考核表31Java程序设计结课报告学生信息管理系统第1章 学生信息管理系统简介1.1 系统功能本系统主要功能:1 用户登陆界面。该界面可以选择使用者的身份,“管理员,教师,学生”。不同的身份有不同的操作界面和功能权限。ID号和密码输入正确即可登录。学生管理界面。提供了学生学籍信息的查询,相关科目的成绩查询和排名,修改登录密码等功能。2 教师管理界面。提供了对学生学籍信息的查询,添加,修改,删除;学生成绩的录入,修改,删除,查询班级排名。修改密码等功能。3 管理员管理界面。拥有最高的权限。允许添加教师信息和课程信息等。4 登录的用户信息分别存储在SQL数据库的“管理员信息表”, “教师信息表”, “学籍信息表”中,如果用户信息不存在则三张表中,将会无权利登录本管理系统。保证了本学生管理系统的安全性。1.2 系统引用例子课本P228页 13.03课本P231页 13.05课本P247页 13.17课本P249页 13.22课本P370页 20.11第2章 表的设计2.1 系统数据库表结构:教师信息表:字段名 类型空值约束条件教师ID varchar(8)not null主键教师姓名varchar(8)not null登录密码varchar(8)not null课程信息表:字段名 类型空值约束条件课程号 varchar(8)not null主键课程名称varchar(12)not null教师IDvarchar(8)not null外键班级信息表:字段名 类型空值约束条件班级号 varchar(8)not null主键班级名称varchar(8)not null班级人数nchar(4)管理员信息表:字段名 类型空值约束条件管理员ID varchar(10)not null主键登录密码varchar(10)not null成绩信息表:字段名 类型空值约束条件学号 varchar(15)not null主键,外键课程号varchar(8)not null主键,外键成绩smallintnot null学籍信息表:字段名 类型空值约束条件学号int not null主键姓名varchar(30)not null性别char(2)班级号varchar(30)not null外键籍贯char(10) 登录密码moneynot null第3章 连接数据库的实现Mysql连接数据库的关键代码:public class DbOperation /打开连接public static Connection getConnection() Connection con = null;try Class.forName(com.mysql.jdbc.Driver);String url = jdbc:mysql:/127.0.0.1:3306/member; String user = root; / 定义连接数据库的用户名String passWord = raoyang; / 定义连接数据库的密码con = DriverManager.getConnection(url, user, passWord); catch (Exception e) e.printStackTrace();return con;/关闭连接public static void closeConnection(Connection con) if (con != null)try con.close(); catch (SQLException e) e.printStackTrace();第4章 系统详细设计4.1系统登录模块设计1)运行结果:2)实验代码:/登录界面import java.awt.Container;import java.awt.event.*;import java.sql.*;import javax.swing.*;public class Login extends JFrame implements ActionListenerprivate static final long serialVersionUID = 1L; JFrame mm=new JFrame(您好!请您先登录!); JTextField t2=new JTextField(null,15); JTextField t4=new JPasswordField(null,15);public String zh=null; JRadioButton b=new JRadioButton(教师);JRadioButton b1=new JRadioButton(学生);JRadioButton b2=new JRadioButton(管理员);static Connection con;static PreparedStatement sql;static ResultSet res;public void jiemian() mm.setSize(300,340); mm.setVisible(true); mm.setLocation(200,300); JLabel t1=new JLabel(ID号:); JLabel t3=new JLabel(密码:); JButton denglu2=new JButton(登录); denglu2.setContentAreaFilled(false); Container n=mm.getContentPane(); n.setLayout(null); t1.setBounds(40,100,75,35); t2.setBounds(80,100,150,35); t3.setBounds(40,150,75,35); t4.setBounds(80,150,150,35); denglu2.setBounds(120,210,70,30);n.add(t1);n.add(t2); n.add(t3); n.add(t4); n.add(denglu2); b.setBounds(120,50,60,30); b1.setBounds(60,50,80,30); b2.setBounds(180,50,80,30); ButtonGroup rg=new ButtonGroup(); b.setSelected(false); b1.setSelected(false); b1.setSelected(false); n.add(b);n.add(b1); n.add(b2); rg.add(b); rg.add(b1);rg.add(b2); b.setContentAreaFilled(false); b1.setContentAreaFilled(false); b2.setContentAreaFilled(false); denglu2.addActionListener(this); denglu2.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) JButton denglu2=(JButton)arg0.getSource(); boolean flag = true;if(arg0.getSource()=denglu2) if(b1.isSelected() Login app=new Login(); app.Login(); con=app.getConnection();try Class.forName(com.mysql.jdbc.Driver);String url = jdbc:mysql:/127.0.0.1:3306/课设;String user = root;String passWord = raoyang;con = DriverManager.getConnection(url, user, passWord); / 连接连接 catch (Exception e) e.printStackTrace();String id = t2.getText().toString();String mm = t4.getText().toString(); try Statement sql = con.createStatement(); ResultSet res = sql.executeQuery(select * from 学籍);while(res.next() if(res.getString(学号).equals(id)&(res.getString(登入密码).equals(mm) JOptionPane.showMessageDialog(null,登陆成功);flag = false;new xscaozuo(); if(flag) JOptionPane.showMessageDialog(null,登录失败);res.close();catch (SQLException e) e.printStackTrace();else if (b.isSelected() try Class.forName(com.mysql.jdbc.Driver);String url = jdbc:mysql:/127.0.0.1:3306/课设;String user = root;String passWord = raoyang;con = DriverManager.getConnection(url, user, passWord); / 连接连接 catch (Exception e) e.printStackTrace();String id = t2.getText().toString();String mm = t4.getText().toString(); try Statement sql = con.createStatement(); ResultSet res = sql.executeQuery(select * from 教师);while(res.next()if(res.getString(教师ID).equals(id)&(res.getString(登入密码).equals(mm) JOptionPane.showMessageDialog(null,登陆成功);flag = false;new jscaozuo(); if(flag) JOptionPane.showMessageDialog(null,登录失败); res.close();catch (SQLException e) e.printStackTrace();else if (b2.isSelected() con = null;try Class.forName(com.mysql.jdbc.Driver);String url = jdbc:mysql:/127.0.0.1:3306/课设;String user = root;String passWord = raoyang;con = DriverManager.getConnection(url, user, passWord); / 连接连接 catch (Exception e) e.printStackTrace();String id = t2.getText().toString();String mm = t4.getText().toString(); try Statement sql = con.createStatement(); ResultSet res = sql.executeQuery(select * from 管理员);while(res.next()if(res.getString(管理员ID).equals(id)&(res.getString(登入密码).equals(mm) JOptionPane.showMessageDialog(null,登陆成功);flag = false;new guanliyuancaozuo(); if(flag) JOptionPane.showMessageDialog(null,登录失败); res.close(); catch (SQLException e) e.printStackTrace(););public Connection getConnection() return null;public void actionPerformed(ActionEvent e) t2.setText(null);t4.setText(null);public static void main(String args) Login app=new Login(); app.jiemian(); 4.2 系统主界面详细设计4.2.1 管理员操作模块1) 运行结果:2)实验代码:/学生操作界面import java.awt.*;import java.awt.event.*;import javax.swing.*;public class guanliyuancaozuo extends JFrame implements ActionListenerpublic guanliyuancaozuo()setTitle(管理员操作);setLayout(null);JButton b1=new JButton(添加教师信息);b1.setBounds(30,20,140,30);JButton b2=new JButton(修改教师信息);b2.setBounds(30,70,140,30);JButton b3=new JButton(删除教师信息);b3.setBounds(30,120,140,30);JButton b4=new JButton(查询教师信息);b4.setBounds(30,170,140,30);JButton b5=new JButton(教师管理界面);b5.setBounds(30,220,140,30);JButton b6=new JButton(重新登录);b6.setBounds(30,270,140,30);Container c=getContentPane();c.add(b1); c.add(b2); c.add(b3); c.add(b4); c.add(b5); c.add(b6); setSize(220,360);setLocation(100,300);setVisible(true);b1.addActionListener(this);b1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) new tianjiajiaoshi(););b2.addActionListener(this);b2.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) new xiugaijiaoshi(););b3.addActionListener(this);b3.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) new shanchujiaoshi(););b4.addActionListener(this);b4.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) new chaxunjiaoshi(););b5.addActionListener(this);b5.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) new jscaozuo(););b6.addActionListener(this);b6.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) Login app=new Login(); app.jiemian(););4.2.2 教师操作模块1) 运行结果:2)实验代码:/教师操作界面import java.awt.*;import java.awt.event.*;import javax.swing.*;public class jscaozuo extends JFrame implements ActionListenerprivate static final long serialVersionUID = 5328938865248326479L;public jscaozuo()setTitle(教师操作);setLayout(null);JLabel aaa=new JLabel(学生信息管理:);JLabel aaa1=new JLabel(学生成绩管理:);JButton b1=new JButton(显示学生信息);b1.setBounds(40,45,140,30);JButton b2=new JButton(添加学生信息);b2.setBounds(200,45,140,30);JButton b3=new JButton(修改学生信息);b3.setBounds(40,90,140,30);JButton b4=new JButton(删除学生信息);b4.setBounds(200,90,140,30);JButton b5=new JButton(录入学生成绩);b5.setBounds(40,170,140,30);JButton b6=new JButton(修改学生成绩);b6.setBounds(200,170,140,30);JButton b7=new JButton(删除学生成绩);b7.setBounds(40,215,140,30);JButton b8=new JButton(查询学生成绩);b8.setBounds(200,215,140,30);JButton b10=new JButton(退出系统);b10.setBounds(40,285,90,30);JButton b11=new JButton(修改密码); b11.setBounds(150,285,90,30);JButton back=new JButton(重新登录); back.setBounds(260,285,90,30);aaa.setBounds(15,15,90,30); aaa1.setBounds(15,140,90,30);Container c=getContentPane();c.add(b1); c.add(b2); c.add(b3); c.add(b4); c.add(b5); c.add(b6); c.add(b7); c.add(b8); c.add(b10); c.add(b11); c.add(back);c.add(aaa); c.add(aaa1);setSize(400,420);setLocation(200,300);setVisible(true);back.addActionListener(this); back.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) Login app=new Login(); app.jiemian();); b1.addActionListener(this); b1.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) new chaxunxs(); );b2.addActionListener(this); b2.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) new tianjiaxuesheng(); );b3.addActionListener(this); b3.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) new xiugaixuesheng();); b4.addActionListener(this); b4.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) new shanchuxuesheng(); ); b5.addActionListener(this); b5.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) new dengruxschengji(); ); b6.addActionListener(this); b6.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) new xiugaixschengji(); ); b7.addActionListener(this); b7.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) new shanchuxschengji(); ); b8.addActionListener(this); b8.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) new chaxunxschengji(); ); b11.addActionListener(this); b11.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) new xiugaijiaoshimima(); ); b10.addActionListener(this);b10.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) System.exit(0););4.2.3 学生操作模块1)运行结果:2)实验代码:/学生操作界面import java.awt.*;import java.awt.event.*;import javax.swing.*;public class xscaozuo extends JFrame implements ActionListenerpublic xscaozuo()setTitle(学生操作);setLayout(null);JButton b1=new JButton(显示学生信息);b1.setBounds(30,20,140,30);JButton b2=new JButton(查询学生成);b2.setBounds(30,70,140,30);JButton b3=new JButton(修改密码);b3.setBounds(30,120,140,30);JButton b4=new JButton(重新登录);b4.setBounds(30,170,140,30);Container c=getContentPane();c.add(b1); c.add(b2); c.add(b3); c.add(b4); setSize(220,260);setLocation(100,300);setVisible(true);b1.addActionListener(this); b1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) new chaxunxs();); b2.addActionListener(this); b2.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) new chaxunxschengji(););b3.addActionListener(this);b3.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) new xiugaixueshengmima(););b4.addActionListener(this);b4.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) Login app=new Login(); app.jiemian(););第5章 系统运行与测试5.1 管理员登录 点击“管理员”按钮。输入正确的ID和密码。验证成功则可进入管理员管理界面。管理员ID号和登录密码存在数据库中的管理员信息表。表中存在的管理员才允许登录。(1)添加教师信息。在弹出的输入栏中输入正确的数据。(2)修改教师信息 (3)删除信息修改 (4)查询教师信息 (5)教师管理界面同下面的教师操作界面5.2 教师登录 在登录界面选择“教师”按钮,并输入正确的ID号和密码,即可登录成功!输入错误则会弹出提示! ID号输入正确,登录成功!进入教师管理的操作界面:(1)显示学生信息 (2)添加学生信息(3)修改学生信息,输入正确则显示! (4) 删除学生信息 (5) 录入学生成绩(6) 修改学生成绩 (7) 删除学生成绩 (8)查询学生成绩 (9)更改登录密码 5.3 学生登录 (1)查询个人成绩(2)查询学生成绩 (3)修改密码 部分实验代码:/添加老师信息:public class tianjiajiaoshi extends JFrame implements ActionListenerprivate static final long serialVersionUID = 1L;JFrame mm=new JFrame(添加教师信息); JTextField t2=new JTextField(null,30); JTextField t4=new JTextField(null,30); JTextField t6=new JTextField(null,30); JTextField t8=new JTextField(null,30); JTextField t10=new JTextField(null,30); static Connection con;static PreparedStatement sql;static ResultSet res;public Connection getConnection()/*省略数据库连接的代码*/return con;private void tianjiajiaoshi() mm.setSize(250,300); mm.setVisible(true); mm.setLocation(200,300); JLabel t1=new JLabel(请输入教师ID:); JLabel t3=new JLabel(请输入教师姓名:); JLabel t5=new JLabel(请输入教师的登录密码:); JButton querenxiugai=new JButton(确认添加); querenxiugai.setContentAreaFilled(false); Container n=mm.getContentPane(); n.setLayout(null); t1.setBounds(50,10,150,30); t2.setBounds(50,40,150,30); t3.setBounds(50,70,150,30); t4.setBounds(50,100,150,30); t5.setBounds(50,130,150,30); t6.setBounds(50,160,150,30); querenxiugai.setBounds(80,210,90,30); n.add(t1);n.add(t2); n.add(t3); n.add(t4); n.add(t5); n.add(t6); n.add(querenxiugai); querenxiugai.addActionListener(this); querenxiugai.addActionListener(new ActionListener()public void actionPerformed(ActionEvent arg0) JButton queren=(JButton)arg0.getSource(); boolean flag = false;if(arg0.getSource()=queren) try Class.forName(com.mysql.jdbc.Driver);String url = jdbc:mysql:/127.0.0.1:3306/课设;String user = root;String passWord = raoyang;con = DriverManager.getConnection(url, user, passWord); catch (Exception e) e.printStackTrace();String a= t2.getText();String b=t4.getText();String c=t6.getText(); try Statement sq = con.createStatement(); ResultSet res = sq.executeQuery(select * from 教师);while(res.next() if(res.getString(教师ID).equals(a)JOptionPane.showMessageDialog(null,该教师已存在!请重新输入!);if(!flag)sql=con.prepareStatement(insert into 教师+ values(?,?,?);sql.setString(1,a);sql.setString(2,b);sql.setString(3,c);sql.executeUpdate();JOptionPane.showMessageDialog(null,添加教师信息成功!);flag = true;new guanliyuancaozuo();break; res.close(); catch (SQLException e) e.printStackTrace(););/删除教师信息public class shanchujiaoshi extends JFrame implements ActionListenerprivate static final long serialVersionUID = 1L;JFrame mm=new JFrame(删除教师信息); JTextField t2=new JTextField(null,30); static Connection con; static PreparedStatement sql; static ResultSet res;public shanchujiaoshi() mm.setSize(260,160); mm.setVisible(true); mm.setLocation(260,200); JLabel t1=new JLabel(请输入要删除的教师ID:); JButton queren=new JButton(确认); JButton quxiao=new JButton(取消); que
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025龙门吊买卖合同样本
- 2025合肥市合同范本
- 2025编剧劳动合同
- 2025年度施工合同范本
- 2025办公设备租赁合同标准模板
- 2025混凝土销售合同范本
- 2025关于租房中介签订的合同范本
- 2025混凝土分包合同范本
- 2025设备供应安装合同模板
- 行政管理与中华文化试题及答案
- HSK六级真题与答案下载(第一套)
- 铁总物资〔2015〕117号:铁路建设项目甲供物资目录
- 二年级期中家长会课件PPT
- 初三综合素质评价自我陈述报告(16篇)
- 工资条(标准模版)
- 2023年江西南昌高新区社区工作者招聘54人(共500题含答案解析)笔试历年难、易错考点试题含答案附详解
- 四川省中小流域暴雨洪水计算表格(尾矿库洪水计算)
- 教育部中等职业学校教学大纲
- 中药斗谱排列方法 斗谱的编排原则
- 《海底两万里》1-47章练习题(含答案)
- GB/T 23703.2-2010知识管理第2部分:术语
评论
0/150
提交评论