




免费预览已结束,剩余30页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
通达学院2017/2018 学年 第 1 学期课程设计 实验报告模 块 名 称 综合软件设计 专 业 通信工程 学 生 班 级 141301 学 生 学 号 14130118 学 生 姓 名 陈启朋 指 导 教 师 王诚 设计题目一、在线考试系统二、学生成绩管理系统任务要求目的:通过本次软件设计,使学生掌握并能熟练运用Java、Delphi、C+语言编写程序以及能编写基于WEB的多层架构应用程序,掌握面向对象的概念。任务:JDK安装与设置JVM环境、C+集成开发环境或Delphi集成开发环境;掌握C/S结构的编程方法;实现与数据库的连接及相关的SQL操作;掌握并编写基于Web的应用程序等。 实验设备及软件硬件:兼容机一台软件:开发工具;Tomcat5.0;Oracle9i数据库 同组人员学号及姓名14130118 陈启朋14130119 张世宇参考文献1.明日科技编著 Java经典编程300例 清华大学出版社2.孙更新 宾晟 宫生文 编著Java程序开发大全中国铁道出版社3.明日科技 李伟 王国辉 编著Java典型模块与项目实战大全电子工业出版社4.明日科技 白伟明 张振坤 李伟等编著实战突击Java 项目开发案例整合电子工业出版社5张帆等编著Java范例开发大全清华大学出版社4目 录第一章 在线考试系统11.1 实验目的11.2 实验内容11.3.1考试登录模块设计11.3.2管理员模块设计71.4 实验结果12第二章 学生成绩管理系统132.1 实验目的132.2 实验内容132.3 实验过程132.3.1学生成绩管理模块设计132.3.2 公共模块设计182.4 实验结果20总 结21参考文献21第1章 在线考试系统1.1 实验目的通过本次软件设计,使学生掌握并能熟练运用Java和mysql语言编写程序,掌握面向对象的概念,采用C/S结构,设计数据库模型,能够了解和数据库连接的方法。1.2 实验内容本次实验的内容是编辑生成试题库,随机生成本次考试试题,提供在先评分并保存结果;同时,管理员可以添加、修改、删除考题和考生用户。1.3 实验过程1.3.1考试登录模块设计主要程序如下:package com.Exam.Index;import java.awt.Insets;import javax.swing.*;import javax.swing.GroupLayout;import javax.swing.LayoutStyle;import com.Exam.bean.*;import com.Exam.controller.ControllerFrame;import com.Exam.dao.*;public class MyLand extends javax.swing.JFrame initComponents(); SuppressWarnings(unchecked) private void initComponents() jTextField3 = new javax.swing.JTextField(); jTextField1 = new javax.swing.JTextField(); jpanel = new MyJPanel(); choicejLabel = new javax.swing.JLabel(); userChoicejComboBox = new javax.swing.JComboBox(); choicejLabel1 = new javax.swing.JLabel(); UserNameTextField = new javax.swing.JTextField(); choicejLabel2 = new javax.swing.JLabel(); PassWordjTextField = new javax.swing.JPasswordField(); enterButton = new javax.swing.JButton(); enterButton.setMargin(new Insets(2, 2, 2, 2); resButtonjButton = new javax.swing.JButton(); resButtonjButton.setMargin(new Insets(2, 2, 2, 2); jTextField3.setText(jTextField3); jTextField1.setText(jTextField1); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); choicejLabel.setText(选择用户:); userChoicejComboBox.setModel(newjavax.swing.DefaultComboBoxModel(new String ,考生, 管理员 ); setTitle(考试系统); choicejLabel1.setText(用 户 名:); UserNameTextField.setText(); choicejLabel2.setText( 密 码 :); PassWordjTextField.setText(); enterButton.setText(登录); enterButton.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) enterButtonActionPerformed(evt); ); resButtonjButton.setText(重置); resButtonjButton.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) jButton2ActionPerformed(evt); ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane(); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jpanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jpanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); javax.swing.GroupLayout jpanelLayout = new javax.swing.GroupLayout(jpanel); jpanelLayout.setHorizontalGroup( jpanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addGroup(jpanelLayout.createSequentialGroup() .addGap(216, 216, 216).addGroup(jpanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jpanelLayout.createSequentialGroup() .addComponent(choicejLabel, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(userChoicejComboBox, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addGroup(jpanelLayout.createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED .addGroup(jpanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jpanelLayout.createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(choicejLabel2, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(PassWordjTextField, GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE) .addGroup(jpanelLayout.createSequentialGroup() .addComponent(choicejLabel1, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(UserNameTextField, GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE) .addGap(82, 82, 82) .addGroup(jpanelLayout.createSequentialGroup() .addContainerGap(256, Short.MAX_VALUE) .addComponent(enterButton, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(resButtonjButton) .addGap(123, 123, 123) ); jpanelLayout.setVerticalGroup( jpanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jpanelLayout.createSequentialGroup() .addGap(85, 85, 85).addGroup(jpanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(choicejLabel) .addComponent(userChoicejComboBox, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jpanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(choicejLabel1) .addComponent(UserNameTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jpanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(choicejLabel2) .addComponent(PassWordjTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jpanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(resButtonjButton, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .addComponent(enterButton, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .addContainerGap(71, Short.MAX_VALUE) ); jpanel.setLayout(jpanelLayout); pack(); private void enterButtonActionPerformed(java.awt.event.ActionEvent evt) if(userChoicejComboBox.getSelectedIndex()=0)JOptionPane.showMessageDialog(this, 没有确定路径的用户类型, 信息对话框,JOptionPane.WARNING_MESSAGE);return;if(UserNameTextField.getText().equals()JOptionPane.showMessageDialog(this, 用户名不能为空,密码不能为空,JOptionPane.WARNING_MESSAGE);return;if(PassWordjTextField.getText().equals()JOptionPane.showMessageDialog(this,密码不能为空,信息对话框,JOptionPane.WARNING_MESSAGE);return;MyFindUserDao findUser = new MyFindUserDao();User user = new User();user.setUserName(UserNameTextField.getText();user.setPassWord(PassWordjTextField.getText();User users = findUser.getUser(user);if(users.getUserType() = 1 & !(userChoicejComboBox.getSelectedItem().equals(管理员)JOptionPane.showMessageDialog(this,登录系统身份不符,信息对话框,JOptionPane.WARNING_MESSAGE);return;if(users.getUserType() = 0) & !(userChoicejComboBox.getSelectedItem().equals(考生)JOptionPane.showMessageDialog(this,登录系统身份不符,信息对话框,JOptionPane.WARNING_MESSAGE);return;if(users.getId()!= 0 )&(users.getUserType()=0)int id = users.getId();java.io.File file = new java.io.File(save.txt);try if(file.exists()file.delete();file.createNewFile();java.io.FileOutputStream out = new java.io.FileOutputStream(file);byte buy = (+id).getBytes();out.write(buy);out.close(); catch (Exception e) e.printStackTrace();InsertUserDao insertUserDao = new InsertUserDao();insertUserDao.setUserHaveIn(users);StudentExam studentExam = new StudentExam();studentExam.setVisible(true);studentExam.setBounds(200, 200, 400, 300);studentExam.setTitle(考试系统);this.dispose();if(users.getId()!=0)&(users.getUserType()=1)dispose();ControllerFrame controller = new ControllerFrame();controller.setVisible(true);controller.setBounds(100,100, 700, 500);else if(users.getId() = 0)JOptionPane.showMessageDialog(this,用户名或密码错误,信息对话框,JOptionPane.WARNING_MESSAGE);private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) UserNameTextField.setText();PassWordjTextField.setText();public static void main(String args) MyLand myLand = new MyLand();myLand.setVisible(true); private javax.swing.JLabel choicejLabel; private javax.swing.JLabel choicejLabel1; private javax.swing.JLabel choicejLabel2; private javax.swing.JButton enterButton; private javax.swing.JButton resButtonjButton; private javax.swing.JComboBox userChoicejComboBox; private javax.swing.JPasswordField PassWordjTextField; private javax.swing.JTextField jTextField1; private javax.swing.JTextField UserNameTextField; private javax.swing.JTextField jTextField3; private MyJPanel jpanel;1.3.2管理员模块设计添加用户模块设计主要程序如下:package com.Exam.controller;import javax.swing.JOptionPane;import com.Exam.bean.*;import com.Exam.dao.*;public class AddFrame extends javax.swing.JFrame public AddFrame() / 构造方法 initComponents();/ 调用初始化组件 SuppressWarnings(unchecked) / /GEN-BEGIN:initComponents private void initComponents() jLabel1 = new javax.swing.JLabel(); qTypejComboBox = new javax.swing.JComboBox(); userNameLabel = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); userPassWord = new javax.swing.JLabel(); jPasswordField1 = new javax.swing.JPasswordField(); okUserName = new javax.swing.JLabel(); jPasswordField2 = new javax.swing.JPasswordField(); addButton = new javax.swing.JButton(); reset = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() / 为窗口设置监听 public void windowClosing(java.awt.event.WindowEvent evt) formWindowClosing(evt);/ 调用窗口监听的方法 ); jLabel1.setText(用户类型:); qTypejComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String -请选择用户身份-, 考生, 管理员 ); userNameLabel.setText(用户姓名:); jTextField1.setText(); userPassWord.setText(用户密码:); jPasswordField1.setText(); okUserName.setText(确认密码:); jPasswordField2.setText(); addButton.setText(添加); addButton.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) addButtonActionPerformed(evt); ); reset.setText(重置); reset.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) resetActionPerformed(evt); ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane(); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(64, 64, 64) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(okUserName) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPasswordField2, 0, 0, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(userPassWord) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPasswordField1, 0, 0, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(userNameLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(qTypejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(74, 74, 74) .addGroup(layout.createSequentialGroup() .addGap(115, 115, 115) .addComponent(addButton) .addGap(31, 31, 31) .addComponent(reset) .addContainerGap(107, Short.MAX_VALUE) ); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(39, 39, 39) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(qTypejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(userNameLabel) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(userPassWord) .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(okUserName) .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(reset) .addComponent(addButton) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); private void addButtonActionPerformed(java.awt.event.ActionEvent evt) String strQtype = qTypejComboBox.getSelectedItem().toString();/ 获得前台选择的下拉列表内容if(jTextField1.getText().equals()JOptionPane.showMessageDialog(this, 请输入用户姓名,信息对话框,JOptionPane.WARNING_MESSAGE);/ this表示此窗口return;if(!jPasswordField1.getText().equals(jPasswordField2.getText()JOptionPane.showMessageDialog(this,两次输入的密码不一致, 信息对话框,JOptionPane.WARNING_MESSAGE);return;User user = new User();if(strQtype.equals(-请选择用户身份-)JOptionPane.showMessageDialog(this,请选择用户身份,信息对话框,JOptionPane.WARNING_MESSAGE);return;if(strQtype.equals(考生)user.setUserType(0);if(strQtype.equals(管理员)user.setUserType(1);MyFindUserDao findUser = new MyFindUserDao();java.util.List list = findUser.findUser();for(int i = 0;ilist.size();i+)User users = (User)list.get(i);if(users.getUserName().equals(jTextField1.getText()System.out.println(USERNAME +users.getUserName();JOptionPane.showMessageDialog(this,该用户名已存在 ,信息对话框,JOptionPane.WARNING_MESSAGE);return;int i = findUser.getUserID();user.setUserName(jTextField1.getText();MyMD5 myMD5 = new MyMD5();user.setId(i+1);System.out.println(list +list.size()+1);user.setPassWord(myMD5.createPassWord(
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年房地产项目包销及风险管理合作协议
- 2025版个人二手房装修合同规范范本
- 2026届吉林省农安县新农中学中考数学猜题卷含解析
- 2025年度科研仪器设备定向采购合同
- 二零二五年度二手车买卖双方隐私保护合同
- 2025版冷却塔余热回收利用项目合同
- 芜湖宣城机场建设投资有限公司招聘考试真题2024
- 甘肃财贸职业学院招聘事业编制工作人员考试真题2024
- 2024年第五冶金建设公司职工大学辅导员考试真题
- 2025版钢琴行业市场调研合同集锦
- 浙江省宁波东钱湖奇奇田园度假俱乐部建筑设计
- GB/T 11822-2008科学技术档案案卷构成的一般要求
- 2022年海北市辅警招聘笔试试题及答案解析
- 经鼻肠梗阻导管护理课件
- 国际物流培训课件
- 2022年安徽芜湖技师学院教师招聘笔试题库及答案解析
- 人才盘点操作及应用(简版)
- 学校老师联系方式惠州市
- T∕CSBME 007-2019 基于增材制造的金属样件压缩性能试验方法
- 筛机的主要部件设计和计算
- 工地八大员岗位责任制标牌
评论
0/150
提交评论