![學生成績管理系統(tǒng)最終完美修復(fù)版.docx_第1頁](http://file.renrendoc.com/FileRoot1/2020-1/11/335d6c59-0208-4396-958a-a2a58b46f231/335d6c59-0208-4396-958a-a2a58b46f2311.gif)
![學生成績管理系統(tǒng)最終完美修復(fù)版.docx_第2頁](http://file.renrendoc.com/FileRoot1/2020-1/11/335d6c59-0208-4396-958a-a2a58b46f231/335d6c59-0208-4396-958a-a2a58b46f2312.gif)
![學生成績管理系統(tǒng)最終完美修復(fù)版.docx_第3頁](http://file.renrendoc.com/FileRoot1/2020-1/11/335d6c59-0208-4396-958a-a2a58b46f231/335d6c59-0208-4396-958a-a2a58b46f2313.gif)
![學生成績管理系統(tǒng)最終完美修復(fù)版.docx_第4頁](http://file.renrendoc.com/FileRoot1/2020-1/11/335d6c59-0208-4396-958a-a2a58b46f231/335d6c59-0208-4396-958a-a2a58b46f2314.gif)
![學生成績管理系統(tǒng)最終完美修復(fù)版.docx_第5頁](http://file.renrendoc.com/FileRoot1/2020-1/11/335d6c59-0208-4396-958a-a2a58b46f231/335d6c59-0208-4396-958a-a2a58b46f2315.gif)
已閱讀5頁,還剩16頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
裝訂線長 春 大 學 課程設(shè)計紙 目錄一、 設(shè)計目的 2二、 功能介紹 2三、 程序流程 2四、 設(shè)計步驟(不用加過多代碼) 21. 設(shè)計數(shù)據(jù)庫 建表 22. 新用戶注冊功能 33. 注冊用戶登錄功能 3 4. 學生成績的錄入功能 45. 數(shù)據(jù)查詢功能 56. 按條件刪除數(shù)據(jù)功能 6五、 設(shè)計總結(jié) 6六、 程序清單 7 一、 設(shè)計目的學生成績管理系統(tǒng)是一個教育單位不可缺少的部分,它的內(nèi)容對于學校的決策者和管理者來說都至關(guān)重要。重點介紹了學生成績管理系統(tǒng)的實現(xiàn)過程:包括系統(tǒng)分析、 系統(tǒng)調(diào)查、功能設(shè)計、數(shù)據(jù)庫設(shè)計、系統(tǒng)實現(xiàn)、系統(tǒng)測試和調(diào)試等。本系統(tǒng)主要功能有教師管理、學生管理、班級管理、學生信息管理、成績管理、留言管理,包括功能需求描述、數(shù)據(jù)庫設(shè)計等內(nèi)容。二、 功能介紹(1)具有新用戶注冊功能。(2)具有注冊用戶登錄功能。(3)具有學生成績的錄入功能,自動計算每個學生的總成績。(4)具有數(shù)據(jù)查詢功能,可以實現(xiàn)查詢?nèi)啃畔⒑桶礂l件執(zhí)行查詢。(5)具有按條件刪除數(shù)據(jù)功能。三、程序流程學生成績管理系統(tǒng)退出管理登錄查找學生成績刪除學生成績錄入學生成績管理員登錄新用戶注冊三、 設(shè)計步驟(不用加過多代碼)(1)設(shè)計數(shù)據(jù)庫,建表A:表usersB:表grade(2)新用戶注冊。if(dbopt.Register(jtf_username.getText(), new String(jtf_password.getPassword(), sex, jtf_email.getText(), jtf_addr.getText() JOptionPane.showMessageDialog(this, 注冊成功了); LoginFrame lf=new LoginFrame(); this.dispose(); else JOptionPane.showMessageDialog(this, 出錯了,請重新嘗試,rn如果還出錯請聯(lián)系管理員!); (3)注冊用戶登錄功能。 if(e.getSource()=login)if(dbopt.check(jtf.getText(), new String(jpf.getPassword()StuInfoFrame sif=new StuInfoFrame();this.dispose();elseJOptionPane.showMessageDialog(this, 用戶名或密碼錯誤);jtf.setText();jpf.setText();(4) 學生成績的錄入功能1、錄入的學生成績信息均不為空,即錄入成功if(dbop.putInforIntoDb(jtf_name.getText(),Integer.parseInt(jtf_sid.getText(), jtf_sex.getText(),jtf_depart.getText(), Integer.parseInt(jtf_cs.getText(),Integer.parseInt( jtf_ccs.getText(), Integer.parseInt(jtf_javas.getText()JOptionPane.showMessageDialog(this, 這條學生成績信息錄入成功!);else JOptionPane.showMessageDialog(this, 出錯了,請檢查你輸入的信息后重新錄入,rn如果還出錯,請聯(lián)系管理員!);2、學生總成績ps=(PreparedStatement) conn.prepareStatement(INSERT INTO grade (name,sid,sex,sdepart,cs,ccs,javas,sum) VALUES (?,?,?,?,?,?,?,?);); ps.setInt(8, sum=cs+ccs+javas);(5)數(shù)據(jù)查詢功能A:學生成績管理界面B:按學生學號搜索學生成績信息ConnDB cd=new ConnDB(); conn=cd.getConn();ps=(PreparedStatement) conn.prepareStatement(SELECT * FROM grade WHERE sid=+sid+); res=ps.executeQuery();C:查詢所有學生的成績ConnDB cd=new ConnDB();conn=cd.getConn();ps=(PreparedStatement) conn.prepareStatement(SELECT * FROM grade); res=ps.executeQuery();(6)刪除學生信息。ConnDB cd=new ConnDB(); conn=cd.getConn(); ps=(PreparedStatement) conn.prepareStatement(DELETE FROM grade WHERE sid=+id); int sid=ps.executeUpdate();五、設(shè)計總結(jié) 繼C+之后學習Java 程序設(shè)計語言會感覺很輕松,因為Java 與C+語法類似,并把C+中一些較低級和較難以理解的功能都去掉了,如多繼承、指針等,同時Java增強了部分功能,如“+”運算符的重載。對于初學Java的人而言,難點是 Java中的 引用、初始化一個類過程等??偟膩碚f,Java 其易于學習、高效率的執(zhí)行方式、平臺無關(guān)性、分布式與高安全性及其豐富的API文檔和類庫等特點都說明Java 是程序設(shè)計語言的偉大進步的表現(xiàn)。可以說這么說,本次課程設(shè)計綜合考察了我們對Java程序設(shè)計知識的掌握熟練程度和實際運用能力。其間,涉及到了Java 中的絕大多數(shù)的知識點,如Java圖形用戶界面設(shè)計、Java的異常處理機制、Java中的多線程程序設(shè)計、Java輸入輸出流等。程序?qū)崿F(xiàn)的關(guān)鍵在于功能的合理劃分以及各個包或者類之間的通訊問題,只要分析清楚這兩點,剩下的就是按部就班的寫代碼了。所以設(shè)計是關(guān)鍵。六、程序清單1、ConnDB.java/* * * 數(shù)據(jù)庫連接*/import java.sql.Connection;import java.sql.DriverManager;public class ConnDB private Connection conn=null; public Connection getConn() try Class.forName(com.mysql.jdbc.Driver);conn=DriverManager.getConnection(jdbc:mysql:/localhost:3306/mykcdesign,root,root); catch(Exception e) e.printStackTrace(); return conn; 2、DBOperate.javaimport java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.util.ArrayList;public class DBOperate private Connection conn=null;private PreparedStatement ps=null;private ResultSet res =null;/錄入學生成績public boolean putInforIntoDb(String name,int sid,String sex,String depart,int cs,int ccs,int javas)int sum;boolean b=false;try ConnDB cd=new ConnDB();conn=cd.getConn();ps=(PreparedStatement) conn.prepareStatement(INSERT INTO grade (name,sid,sex,sdepart,cs,ccs,javas,sum) VALUES (?,?,?,?,?,?,?,?););ps.setString(1, name);ps.setInt(2, sid);ps.setString(3, sex );ps.setString(4, depart);ps.setInt(5, cs);ps.setInt(6, ccs);ps.setInt(7, javas);ps.setInt(8, sum=cs+ccs+javas);/學生總成績有所有科目成績相加得出int cont=ps.executeUpdate();if(cont=1)b=true; catch (Exception e) e.printStackTrace(); finallythis.close();return b;/驗證用戶public boolean check(String u,String p)boolean b=false;tryConnDB cd=new ConnDB();conn=cd.getConn();ps=(PreparedStatement) conn.prepareStatement(select userpwd from users where username=+u+);res=ps.executeQuery();if(res.next()String dbpwd=res.getString(1);if(dbpwd.equals(p)b=true;catch(Exception e)e.printStackTrace();finallythis.close();return b;/注冊用戶public boolean Register(String username,String password,String sex,String email,String address)boolean b=false;try ConnDB cd=new ConnDB();conn=cd.getConn();ps=(PreparedStatement) conn.prepareStatement(INSERT INTO users (username,userpwd,sex,e_mail,address) VALUES (?,?,?,?,?); ps.setString(1, username); ps.setString(2, password); ps.setString(3, sex); ps.setString(4, email); ps.setString(5, address); int num=ps.executeUpdate(); if(num=1) b=true; catch (Exception e) e.printStackTrace(); finallythis.close();return b;/刪除學生成績public boolean Deleteuser(String id)boolean b=false;try ConnDB cd=new ConnDB();conn=cd.getConn();ps=(PreparedStatement) conn.prepareStatement(DELETE FROM grade WHERE sid=+id); int sid=ps.executeUpdate(); if(sid=1) b=true; catch (Exception e) e.printStackTrace(); finallythis.close(); return b;/按學號查找學生成績public gradeBean getAGradeInfo(String tid)gradeBean grb=new gradeBean();if(tid.equals()return null;int sid=Integer.parseInt(tid);try ConnDB cd=new ConnDB();conn=cd.getConn();ps=(PreparedStatement) conn.prepareStatement(SELECT * FROM grade WHERE sid=+sid+); res=ps.executeQuery(); while(res.next() grb.setNum(res.getInt(1); grb.setName(res.getString(2); grb.setSid(res.getInt(3); grb.setSex(res.getString(4); grb.setSdepart(res.getString(5); grb.setCs(res.getInt(6); grb.setCcs(res.getInt(7); grb.setJavas(res.getInt(8); grb.setSum(res.getInt(9); catch (Exception e) e.printStackTrace(); finallythis.close();return grb;/顯示所有學生的成績public ArrayList ShowGradeInfo()ArrayList al=new ArrayList();try ConnDB cd=new ConnDB();conn=cd.getConn();ps=(PreparedStatement) conn.prepareStatement(SELECT * FROM grade); res=ps.executeQuery(); while(res.next() gradeBean grb=new gradeBean(); grb.setNum(res.getInt(1); grb.setName(res.getString(2); grb.setSid(res.getInt(3); grb.setSex(res.getString(4); grb.setSdepart(res.getString(5); grb.setCs(res.getInt(6); grb.setCcs(res.getInt(7); grb.setJavas(res.getInt(8); grb.setSum(res.getInt(9); al.add(grb); catch (Exception e) e.printStackTrace(); finallythis.close();return al;/關(guān)閉資源public void close()tryif(res!=null)res.close();res=null;if(ps!=null)ps.close();ps=null;if(conn!=null)conn.close();conn=null;catch(Exception e)e.printStackTrace();3、LoginFrame.javaimport java.awt.Color;import java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;public class LoginFrame extends JFrame implements ActionListener JPanel mainjp;Color mainjp_color;JLabel titleLb;JLabel jlb_username;JLabel jlb_password;JTextField jtf;JPasswordField jpf;JButton login;JButton regist;DBOperate dbopt;public LoginFrame()dbopt=new DBOperate(); this.init();public void init()/主面板mainjp_color=new Color(189,227,241);mainjp=new JPanel();mainjp.setLayout(null);/用戶名jlb_username=new JLabel(用戶名:);jlb_username.setBounds(50, 50, 50, 30);jtf=new JTextField(100);jtf.setBounds(110, 50, 200, 30);/密碼jlb_password=new JLabel(密 碼:);jlb_password.setBounds(50, 90, 50, 30);jpf=new JPasswordField(100);jpf.setBounds(110, 90, 200, 30);/標題titleLb=new JLabel( 學生成績管理系統(tǒng)登錄界面);titleLb.setFont(new Font(微軟雅黑, 1, 20);titleLb.setOpaque(true);titleLb.setBackground(mainjp_color);/注冊按鈕和登錄按鈕login=new JButton(登 錄);login.addActionListener(this);login.setBounds(80, 150, 100, 30);regist=new JButton(注 冊);regist.addActionListener(this);regist.setBounds(200, 150, 100, 30); /設(shè)置背景色mainjp.setBackground(mainjp_color);/添加mainjp.add(jlb_username);mainjp.add(jlb_password);mainjp.add(jtf);mainjp.add(jpf);mainjp.add(login);mainjp.add(regist);this.add(titleLb,North);this.add(mainjp,Center);/Frame部分this.setSize(400, 300);this.setVisible(true);this.setTitle(學生成績管理系統(tǒng));this.setResizable(false);this.setLocationRelativeTo(null);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);public static void main(String args) / TODO Auto-generated method stub LoginFrame mf=new LoginFrame();public void actionPerformed(ActionEvent e) / TODO Auto-generated method stubif(e.getSource()=login)if(dbopt.check(jtf.getText(), new String(jpf.getPassword()StuInfoFrame sif=new StuInfoFrame();this.dispose();elseJOptionPane.showMessageDialog(this, 用戶名或密碼錯誤);jtf.setText();jpf.setText();else if(e.getSource()=regist)RegisterFrame rf=new RegisterFrame();this.dispose();4、RegisterFrame.javaimport java.awt.Checkbox;import java.awt.CheckboxGroup;import java.awt.Color;import java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;public class RegisterFrame extends JFrame implements ActionListener JLabel titlelb;Color mainjp_color;JPanel mainjp;JPanel mainjp_all;JLabel jlb_username;JLabel jlb_password;JLabel jlb_sex;JLabel jlb_email;JLabel jlb_addr;JTextField jtf_username,jtf_email,jtf_addr;JPasswordField jtf_password; CheckboxGroup cbg; Checkbox cb_man,cb_woman;JButton jb_reg,jb_clear;DBOperate dbopt;public RegisterFrame()dbopt=new DBOperate();this.init();public void init()/背景色設(shè)置mainjp_color=new Color(189,227,241);/標題titlelb=new JLabel( 用戶注冊界面);titlelb.setFont(new Font(微軟雅黑,1,30);titlelb.setOpaque(true);titlelb.setBackground(mainjp_color);/主面板mainjp=new JPanel();mainjp.setBackground(mainjp_color);mainjp.setLayout(null);/放按鈕和文本的面板mainjp_all=new JPanel();mainjp_all.setBounds(20, 40, 350, 300);mainjp_all.setLayout(null);/用戶名jlb_username=new JLabel(用 戶 名:);jtf_username=new JTextField(100);jlb_username.setBounds(10, 5, 80, 30);jtf_username.setBounds(100, 5, 220, 30);/密碼jlb_password=new JLabel(密 碼:);jtf_password=new JPasswordField(20);jlb_password.setBounds(10, 50, 80, 30);jtf_password.setBounds(100, 50, 220, 30);/性別cbg=new CheckboxGroup();jlb_sex=new JLabel(性 別:);cb_man=new Checkbox(男, true,cbg);cb_woman=new Checkbox(女, false,cbg); jlb_sex.setBounds(10, 95, 80, 30); cb_man.setBounds(100, 95, 50, 30); cb_woman.setBounds(160, 95, 50, 30); /郵件jlb_email=new JLabel(電 子 郵 件:);jtf_email=new JTextField(20);jlb_email.setBounds(10, 140, 80, 30);jtf_email.setBounds(100, 140, 220, 30);/地址jlb_addr=new JLabel(家 庭 住 址:);jtf_addr=new JTextField(20);jlb_addr.setBounds(10, 185, 80, 30);jtf_addr.setBounds(100, 185, 220, 30);/按鈕jb_reg=new JButton(注 冊);jb_reg.addActionListener(this);jb_clear=new JButton(重 置);jb_clear.addActionListener(this);jb_reg.setBounds(20, 260, 120, 35);jb_clear.setBounds(180, 260, 120, 35);/添加處理/用戶名mainjp_all.add(jlb_username);mainjp_all.add(jtf_username);/密碼mainjp_all.add(jlb_password);mainjp_all.add(jtf_password);/性別mainjp_all.add(jlb_sex);mainjp_all.add(cb_man);mainjp_all.add(cb_woman);/電子郵件mainjp_all.add(jlb_email);mainjp_all.add(jtf_email);/家庭住址mainjp_all.add(jlb_addr);mainjp_all.add(jtf_addr);/注冊和重置按鈕mainjp_all.add(jb_reg);mainjp_all.add(jb_clear);mainjp_all.setBackground(mainjp_color);mainjp.add(mainjp_all);this.add(titlelb,North);this.add(mainjp,Center);/Frame部分this.setTitle(用戶注冊); this.setSize(400, 510); this.setVisible(true); this.setLocationRelativeTo(null); this.setResizable(false);public void actionPerformed(ActionEvent e) / TODO Auto-generated method stub if(e.getSource()=jb_clear) jtf_username.setText(); jtf_password.setText(); jtf_email.setText(); jtf_addr.setText(); else if(e.getSource()=jb_reg) String sex=; if(cb_man.getState() sex=男; else sex=女; if(dbopt.Register(jtf_username.getText(), new String(jtf_password.getPassword(), sex, jtf_email.getText(), jtf_addr.getText() JOptionPane.showMessageDialog(this, 注冊成功了); LoginFrame lf=new LoginFrame(); this.dispose(); else JOptionPane.showMessageDialog(this, 出錯了,請重新嘗試,rn如果還出錯請聯(lián)系管理員!); 5、StuInfoFrame.javaimport java.awt.Color;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTable;import javax.swing.JTextField;public class StuInfoFrame extends JFrame implements ActionListener Color mainjp_color; JPanel jp_north,jp_norputCom; JPanel jp_center,jp_center_search,jp_center_table,jp_center_add; JLabel jlb; JTextField jtf; JButton jb_go,jb_allgo,jb_addNewInfo; JTable jtable_add,jtableSearch; JButton deletXuJIInfo,addInfo; DBOperate dbop;public StuInfoFrame()dbop=new DBOperate();this.init();this.add(jp_north,North);this.add(jp_center,Center);this.setSize(800, 350);this.setVisible(true);this.setLocationRelativeTo(null);this.setTitle(學生成績管理界面);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);public void init()/主面板顏色mainjp_color=new Color(189,227,241); /上邊jp_north=new JPanel();jp_north.setBackground(mainjp_color);jlb=new JLabel(按照學號搜索學生成績信息:);jlb.setBounds(20, 5, 200, 25);jtf=new JTextField(20);jb_go=new JButton(搜索);jb_go.addActionListener(this);jb_allgo=new JButton(搜索所有學生的成績);jb_allgo.addActionListener(this);jb_addNewInfo=new JButton(錄入學生成績);jb_addNewInfo.addActionListener(this);/中間deletXuJIInfo=new JButton(刪除該學生信息);deletXuJIInfo.addActionListener(this);addInfo=new JButton(錄入學生成績);addInfo.addActionListener(this);jp_center=new JPanel();jp_center.setBackground(mainjp_color);jp_center_search=new JPanel();jp_center_search.setBackground(mainjp_color);/添加jp_north.add(jlb);jp_north.add(jtf);jp_north.add(jb_go);jp_north.add(jb_allgo);jp_north.add(jb_addNewInfo);public void firstCard(gradeBean grb) String strSearch=序號,姓名,學號,性別,院系,C語言 成績,c+成績,Java 成績,總成績;Object objSearch1=new Object29; for(int i=0;i9;i+) objSearch10i=strSearchi; String ssSearch=grb.getNum()+,grb.getName(),grb.getSid()+,grb.getSex(),grb.getSdepart(),grb.getCs()+,grb.get
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年產(chǎn)業(yè)基金戰(zhàn)略合作協(xié)議范文(2篇)
- 2025年二手車轉(zhuǎn)讓協(xié)議不過戶(2篇)
- 2025年臨時工安全生產(chǎn)協(xié)議(三篇)
- 快遞驛站裝修合同協(xié)議書
- 兒童樂園石膏吊頂裝修協(xié)議
- 學校教室翻新承包合同
- 水上養(yǎng)殖沙石運輸合同范本
- 寵物運輸車輛協(xié)議
- 家禽飼料緊急配送服務(wù)協(xié)議
- 服裝輔料物流配送合同
- 2024年山東省泰安市高考語文一模試卷
- 全國助殘日關(guān)注殘疾人主題班會課件
- TCL任職資格體系資料HR
- 《中國古代寓言》導(dǎo)讀(課件)2023-2024學年統(tǒng)編版語文三年級下冊
- 五年級上冊計算題大全1000題帶答案
- 工會工作制度匯編
- 工程建設(shè)行業(yè)標準內(nèi)置保溫現(xiàn)澆混凝土復(fù)合剪力墻技術(shù)規(guī)程
- 液壓動力元件-柱塞泵課件講解
- 人教版五年級上冊數(shù)學脫式計算100題及答案
- 屋面細石混凝土保護層施工方案及方法
- 2024年1月山西省高三年級適應(yīng)性調(diào)研測試(一模)理科綜合試卷(含答案)
評論
0/150
提交評論