Java綜合性實(shí)驗(yàn)學(xué)生成績(jī)管理(整理)_第1頁(yè)
Java綜合性實(shí)驗(yàn)學(xué)生成績(jī)管理(整理)_第2頁(yè)
免費(fèi)預(yù)覽已結(jié)束,剩余12頁(yè)可下載查看

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、綜合性實(shí)驗(yàn)學(xué)生成績(jī)管理系統(tǒng)班級(jí):數(shù)學(xué) 092 學(xué)號(hào): 200912010210 姓名:同艷云實(shí)驗(yàn)儀器設(shè)備:多媒體計(jì)算機(jī)。實(shí)驗(yàn)?zāi)康模涸谡莆障嚓P(guān)基礎(chǔ)知識(shí)的基礎(chǔ)上,學(xué)會(huì)自己設(shè)計(jì)實(shí)驗(yàn),熟練掌握 JDBC 技術(shù)訪問數(shù) 據(jù)庫(kù)(或數(shù)據(jù)文件)的方法、在 Java 中進(jìn)行數(shù)據(jù)庫(kù)應(yīng)用程序開發(fā)的方法和步驟,熟悉 Swing 組件特性和 Action 接口并能夠恰當(dāng)運(yùn)用實(shí)現(xiàn)特定功能,會(huì)開發(fā)多窗體應(yīng)用程 序。實(shí)驗(yàn)要求:在 8 學(xué)時(shí)以內(nèi),制作出能夠?qū)崿F(xiàn)基本功能的學(xué)生成績(jī)管理系統(tǒng)。寫出技術(shù)工作報(bào) 告并附源程序。實(shí)驗(yàn)內(nèi)容及任務(wù):1進(jìn)行數(shù)據(jù)庫(kù)(或數(shù)據(jù)文件)設(shè)計(jì),數(shù)據(jù)分為學(xué)生信息、成績(jī)管理、信息查詢等 三部分;使用學(xué)生信息表、課

2、程表兩個(gè)數(shù)據(jù)表來存放數(shù)據(jù)。2選擇適當(dāng)組件進(jìn)行界面設(shè)計(jì):界面要美觀大方,具有主菜單和相應(yīng)工具欄及按 鈕;3編寫事件代碼:能夠?qū)崿F(xiàn)學(xué)生信息維護(hù)(錄入、修改和刪除);學(xué)生信息瀏覽;按“學(xué)號(hào)”查 詢學(xué)生信息; 按“姓名”和“所在班級(jí)”查詢學(xué)生信息; 按“學(xué)院名稱”查詢學(xué)生信 息;按課程查詢學(xué)生成績(jī)等功能。4分析總結(jié):1 數(shù)據(jù)庫(kù)、數(shù)據(jù)表(或數(shù)據(jù)文件)設(shè)計(jì);1.1 學(xué)生基本信息表包含的信息是學(xué)生編號(hào)、學(xué)生姓名、學(xué)生性別、學(xué)生年齡、家庭住址、聯(lián)系電話等信息,設(shè)計(jì)時(shí)注意ID 字段設(shè)為主鍵,設(shè)為 Int 類型,如表 4.1所示:表 4.1 學(xué)生基本信息表字段名數(shù)據(jù)類型說明IDInt學(xué)生編號(hào)NameVarchar

3、(10)學(xué)生姓名SexChar(10)性別AgeInt年齡AddressVarchar(50)家庭住址PhoneChar(15)聯(lián)系電話1.2 班級(jí)基本信息表包括學(xué)生編號(hào)、科目類型、任課教師、所得分?jǐn)?shù),ID 設(shè)為主鍵,如表 4.2 所示:表 4.2 班級(jí)基本信息信息表字段名數(shù)據(jù)類型說明IDInt學(xué)生編號(hào)OTypeVarchar(10)科目類型ONameVarchar(10)任課教師Gradeint所得分?jǐn)?shù)2.主控模塊設(shè)計(jì);2.1 系統(tǒng)登錄界面,如圖 4.3-4.6 所示。圖 4.3圖 4.4圖 4.52.2 系統(tǒng)主界面,如圖 4.6 所示。圖 4.63.學(xué)生信息維護(hù)模塊設(shè)計(jì);3.1 增加學(xué)生信

4、息界面,如圖 4.7 所示。圖 4.73.2 修改學(xué)生信息界面,如圖 4.8 所示。圖 4.83.3.刪除學(xué)生信息界面,如圖 4.9 所示。圖 4.94.學(xué)生信息查詢模塊設(shè)計(jì);4.1 按學(xué)號(hào)查找學(xué)生信息界面,如圖4.10 所示。圖 4.104.2 按姓名,學(xué)號(hào)查找學(xué)生信息界面,如圖4.11 所示。圖 4.11實(shí)驗(yàn)總結(jié):通過本次實(shí)驗(yàn)設(shè)計(jì),我對(duì) JAVA 的知識(shí)又有了更深的了解,而且對(duì) Swing 界面設(shè)計(jì) 有了更深的領(lǐng)悟,而且更熟練使用JAVA 和數(shù)據(jù)庫(kù)的連接,以及對(duì)簡(jiǎn)單的數(shù)據(jù)庫(kù)查詢語(yǔ)言有了些許了解,然后在編程設(shè)計(jì)階段還是遇到了許多問題,但是通過網(wǎng)上查詢資料,以及和同學(xué)討論這些問題都迎刃而解了,

5、必須要有團(tuán)結(jié)合作精神,而且要吃苦耐 勞,耐心嚴(yán)謹(jǐn),這次設(shè)計(jì)實(shí)驗(yàn)對(duì)我的知識(shí)技能和思維都是一個(gè)很好的鍛煉。附錄1系統(tǒng)登錄界面程序代碼import java.awt.* 。import java.awt.event.*。import javax.swing.* 。class WyFrame extends Frame implements ActionListenerLabel l1,l2。TextField t1,t2。Button b1,b2。public static int k 。public WyFrame()super(學(xué)生管理系統(tǒng)”)。setBackground(Color.light

6、Gray)。 setLayout(null)。setSize(240,160)。 this.setLocationRelativeTo(null)。11= new Label用戶名丄 abel.CENTER)。12=new Label密 碼丄 abel.CENTER)。t1=new TextField()。t2=new TextField()。b1= new Butto n(登入)。b2=new Butto n(退 出)。11.setBounds(40,45,40,30。)12.setBounds(40,80,40,30。)t1.setBounds(90,45,100,25。)t2.setBo

7、unds(90,80,100,25。)b1.setBounds(50,115,60,30。) b2.setBounds(125,115,60,30。)b1.addActionListener(this)。 b2.addActionListener(this)。add(l1)。 add(l2)。 add(t1)。 add(t2)。 add(b1)。 add(b2)。this.addWindowListener(new WindowAdapter()publicvoid windowClosing(WindowEvent e)dispose()。System.exit(0)。)。setVisibl

8、e(true)。public void actionPerformed(ActionEvent e)if(e.getSource()=b1)k=1。if(e.getSource()=b2)k=2。repaint()。if(k=1)if(t1.getText().toString().trim().equals(09321104)&t2.getText().toString().trim().equals(880902)MyMenu hyf=new MyMenu() 。 this.setVisible(false)。elseif(t1.getText().toString().trim(

9、).equals(09321104)JOptio nPan e.showMessageDialog(this,密碼與用戶名不匹配! ) 。elseJOptio nPan e.showMessageDialog(this,用戶名錯(cuò)誤!)。if(k=2)dispose()。 System.exit(0)。public class Loginpublic static void main(String args)WyFrame hyf=new WyFrame()。2. 系統(tǒng)主界面程序代碼(含有菜單)import java.awt.* 。import java.awt.event.*。import j

10、ava.util.* 。public class MyMenu extends Frame implements ActionListenerpublic MyMenu()super(學(xué)生管理系統(tǒng))。setSize(400,300)。setBackground(Color.lightGray)。setVisible(true)。setLocationRelativeTo(null)。this.addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose()。System.exit(0)。

11、)。Menu file=new Menu( 文件 )。Menultem exit=new Menultem(”退出)。file.add(exit) 。Menu student=new Menu(學(xué)生信息管理)。Menultem ins=new Menultem(增加學(xué)生信息)。Me nultem del=new Men ultem(刪除學(xué)生信息)。Me nultem upd=new Men ultem(修改學(xué)生信息)。Me nultem sel=new Men ultem(查找學(xué)生信息)。student.add(ins)。 student.add(del)。 student.add(upd)。

12、 student.add(sel。)MenuBar hyf=new MenuBar()。hyf.add(file)。 hyf.add(student)。setMenuBar(hyf)。exit.addActionListener(this)。ins.addActionListener(this)。del.addActionListener(this)。upd.addActionListener(this)。 sel.addActionListener(this)。public void actionPerformed(ActionEvent e)String strCmd=e.getActio

13、nCommand()。 if(strCmd.equals(退出)System.exit(0)。if(strCmd.equals(增加學(xué)生信息) Insert ins=new Insert()。if(strCmd.equals(刪除學(xué)生信息)Insert del=null。if(strCmd.equals(修改學(xué)生信息)Update upd=new Update()。if(strCmd.equals(查詢學(xué)生信息)Select sel=new Select(。)repaint()。3. 添加學(xué)生信息界面程序代碼import java.awt.*。import java.awt.event.*。i

14、mport javax.swing.* 。import java.util.* 。public class Insert extends Frame implements ActionListener ,ItemListenerCheckboxGroup cg=new CheckboxGroup()。 Label l1,l2,l3,l4,l5,l6,l7 。TextField t1,t2,t3,t4,t5,t6,t7。Button b1,b2。Checkbox c1,c2。public static Student hyf。public static String a1,a2,a3,a4,a5

15、,a6,a7public Insert()super(添加學(xué)生信息界面)。setBackground(Color.lightGray)。 setLayout(null)。11= new Label(姓名丄 abel.CENTER)。12=new Label(性別丄 abel.CENTER)。l3=new Label(出生日期丄 abel.CENTER)。l4=new Label(學(xué)號(hào)丄 abel.CENTER)。 l5=new La be l (計(jì)算機(jī)成績(jī),Label.CENTER)。l6=new Label(英語(yǔ)成績(jī)丄 abel.CENTER)。l7=new Label(數(shù)學(xué)成績(jī)丄 abel

16、.CENTER)。c1= new Checkbox(男 ”,cg,true)。c2=new Checkbox( 女 ”,cg,false)。c1.addItemListener(this)。 c2.addItemListener(this)。 t1=new TextField()。t2=new TextField()。 t3=new TextField()。 t4=new TextField()。 t5=newTextField()。 t6=new TextField()。 t7=new TextField()。 b1=new Button( 確定)。 b2=new Button(退出)。b1

17、.addActionListener(this)。b2.addActionListener(this)。add(l1)。add(t1)。add(l2)。add(t2)。add(l3)。add(t3)。add(l4)。add(t4)。add(l5)。add(t5)。add(l6)。add(t6)。add(l7)。 add(t7)。 add(b1)。 add(b2)。add(c1)。 add(c2)。11.setBounds(40,60,70,30)。12.setBounds(40,90,70,30)。13.setBounds(40,120,70,30。)14.setBounds(40,150,7

18、0,30。)15.setBounds(40,180,70,30。)16.setBounds(40,210,70,30。)17.setBounds(40,240,70,30。) t1.setBounds(120,60,100,30。)c1.setBounds(120,90,50,30。) c2.setBounds(170,90,50,30。)t3.setBounds(120,120,100,30。) t4.setBounds(120,150,100,30。)t5.setBounds(120,180,100,30。) t6.setBounds(120,210,100,30。)t7.setBound

19、s(120,240,100,30。) b1.setBounds(100,280,80,30。)b2.setBounds(200,280,80,30。)c1.setState(true。)a2=男。addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e) dispose()。System.exit(0)。) 。/關(guān)閉窗口 setSize(400,350)。 setLocationRelativeTo(null)。setVisible(true)。public void itemStateChange

20、d(ItemEvent e)if(e.getItemSelectable()=c1)a2=男。if(e.getItemSelectable()=c2)a2=女。public void actionPerformed(ActionEvent e)String strCmd=e.getActionCommand()。if(strCmd.equals(”退出) this.hide()。if(strCmd.equals(” 確定)a1=t1.getText()。char c1=a2.toCharArray()。a3=t3.getText()。a4=t4.getText()。a5=t5.getText(

21、)。a6=t6.getText()。a7=t7.getText()。hyf.setcompScore( Integer.parseInt(a5.trim()。)hyf.setengScore(Integer.parseInt(a6.trim()。)hyf.setmathScore(Integer.parseInt(a7.trim()。) repaint()。4. 修改學(xué)生記錄界面程序代碼import java.awt.* 。import java.awt.event.*。import javax.swing.* 。import java.util.* 。public class Update

22、extends Frame implements ActionListenerLabel l1,l2,l3,l4,l5,l6,l7 。 TextField t1,t2,t3,t4,t5,t6,t7。 Button b1,b2。public static String a1,a2,a3,a4,a5,a6,a7public Update()super(學(xué)生管理增加學(xué)生界面)。setBackground(Color.lightGray)。setLayout(null)。11= new Label姓名丄 abel.CENTER)。12=new Label性別丄 abel.CENTER)。l3=new

23、Label出生日期丄 abel.CENTER)。l4=new Label學(xué)號(hào)丄 abel.CENTER)。l5=new Label計(jì)算機(jī)成績(jī)丄 abel.CENTER)。 l6=new Label英語(yǔ)成績(jī)丄abel.CENTER)。 l7=new Label數(shù)學(xué)成績(jī)丄 abel.CENTER)。 t1=newTextField()。 t2=new TextField()。 t3=new TextField()。 t4=new TextField()。t5=new TextField()。 t6=new TextField()。 t7=new TextField()。 b1=new Button

24、(確定)。 b2=new Button(退出)。b1.addActionListener(this)。b2.addActionListener(this)。add(l1)。add(t1)。add(l2)。add(t2)。add(l3)。add(t3)。add(l4)。add(t4)。add(l5)。add(t5)。add(l6)。add(t6)。add(l7)。 add(t7)。 add(b1)。 add(b2)。11.setBounds(40,60,70,30)。12.setBounds(40,90,70,30)。13.setBounds(40,120,70,30。)14.setBounds

25、(40,150,70,30。)15.setBounds(40,180,70,30。)16.setBounds(40,210,70,30。)17.setBounds(40,240,70,30。) t1.setBounds(120,60,100,30。)t2.setBounds(120,90,100,30。) t3.setBounds(120,120,100,30。)t4.setBounds(120,150,100,30。) t5.setBounds(120,180,100,30。)t6.setBounds(120,210,100,30。) t7.setBounds(120,240,100,30。

26、)b1.setBounds(100,280,80,30。) b2.setBounds(200,280,80,30。)addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) dispose()。 System.exit(0)。) 。/關(guān)閉窗口 setSize(400,350)。 setLocationRelativeTo(null)。setVisible(true)。public void actionPerformed(ActionEvent e)String strCmd=e.getActi

27、onCommand()。if(strCmd.equals(”退出) this.hide()。 if(strCmd.equals(” 確定) a1=t1.getText()。String a2=t2.getText()。 char c1=a2.toCharArray()。a3=t3.getText()。 a4=t4.getText()。 a5=t5.getText()。 a6=t6.getText()。a7=t7.getText()。I=a1。Insert.hyf.sex=c10。Insert.hyf.birthday=a3。 Insert.hyf.number=a4

28、。Insert.hyf.setcompScore( Integer.parseInt(a5.trim()。)Insert.hyf.setengScore(Integer.parseInt(a6.trim()。)Insert.hyf.setmathScore(Integer.parseInt(a7.trim()。) repaint()。5. 查找學(xué)生記錄界面程序設(shè)計(jì)import java.awt.* 。import java.awt.event.*。import javax.swing.* 。import java.util.* 。public class Select extends Fram

29、e implements ActionListenerLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10 。TextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10。Button b1,b2。public Select()super(學(xué)生管理查詢學(xué)生界面”)。setBackground(Color.lightGray)。 setLayout(null)。11= new Label姓名丄 abel.CENTER)。12=new Label性別丄 abel.CENTER)。13=new Label出生日期丄 abel.CENTER)。14=new La

30、bel學(xué)號(hào)丄 abel.CENTER)。15=new Label計(jì)算機(jī)成績(jī)丄 abel.CENTER)。16=new Label英語(yǔ)成績(jī)丄 abel.CENTER)。17=new Label數(shù)學(xué)成績(jī)丄 abel.CENTER)。18=new Label最大值丄 abel.CENTER)。19=new Label最小值丄 abel.CENTER)。110=new Label平均值丄 abel.CENTER)。t1=new TextField()。t2=new TextField()。t3=new TextField()。t4=new TextField()。t5=new TextField()。

31、t6=new TextField()。t7=new TextField()。t8=new TextField()。t9=new TextField()。t10=new TextField()。b1=new Button( 查詢)。b2=new Button(退出)。b1.addActionListener(this)。 b2.addActionListener(this)。 add(l1)。 add(t1)。add(l2)。add(t2)。add(l3)。 add(t3)。add(l4)。add(t4)。add(l5)。add(t5)。add(l6)。add(t6)。add(l7)。add(t

32、7)。add(b1)。add(b2)。 add(t8)。 add(t9)。 add(t10)。 add(l8)。 add(l9)。 add(l10)。11.setBounds(40,60,70,30)。12.setBounds(40,90,70,30)。13.setBounds(40,120,70,30。)14.setBounds(40,150,70,30。)15.setBounds(40,180,70,30。)16.setBounds(40,210,70,30。)17.setBounds(40,240,70,30。)18.setBounds(40,270,70,30。)19.setBounds(40,300,70,30。) l10.setBounds(40,330,70,30。)t1.setBounds(120,60,100,30。) t2.setBounds(120,90,100,30。)t3.setBound

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論