ImageVerifierCode 换一换
格式:DOCX , 页数:36 ,大小:143.82KB ,
资源ID:21475969      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/21475969.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(java学生成绩管理系统课程Word文件下载.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

java学生成绩管理系统课程Word文件下载.docx

1、 this.yuwen = yuwen; this.shuxue = shuxue; this.java = java; public String getName() return name; public void setName(String name) public int getNum() return num; public void setNum(int num) public int getYuwen() return yuwen; public void setYuwen(int yuwen) public int getShuxue() return shuxue; pub

2、lic void setShuxue(int shuxue) public int getJava() return java; public void setJava(int java) public int getSum() return sum; public void setSum(int sum) this.sum = sum; public String toString() return Student name= + name + , num= + num + , yuwen= + yuwen + , shuxue= + shuxue + , java= + java + ,

3、sum= + sum; Student管理类StuC,创建对应方法,实现对Student对象的操作(增、删、改、查询、持久化、成绩排序、成绩统计等功能)供其对象调用。StuC.java代码import java.io.BufferedReader;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.FileReader;import java.io.IOException;imp

4、ort java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.util.ArrayList;public class StuC ArrayList al=new ArrayList(); File file = new File(e:/mydata.dat); /添加 public void adds(Student s) al.add(s); /删除 public void del(int n) for(int i=0;ial.size();i+) if(al.get(i).getNum()=n) al

5、.remove(i); /求总分 public void sum() al.get(i).setSum(al.get(i).getJava()+al.get(i).getShuxue()+al.get(i).getYuwen(); /排序 public void sort() for (int i = 0; i al.size(); i+) for (int j = 0; j al.size()-1-i; j+) if (al.get(j).getSum() al.get(j+1).getSum() Object o=al.get(j); al.set(j, al.get(j+1); al.s

6、et(j+1, (Student) o); public void paint() System.out.println(al.get(i);StuC al= + al + /输出流 public void stor() ObjectOutputStream out = null; try out = new ObjectOutputStream(new FileOutputStream(file); out.writeObject(al); out.close(); catch (FileNotFoundException e) e.printStackTrace(); catch (IOE

7、xception e) /输入流 public void read() ObjectInputStream in = null; in = new ObjectInputStream(new FileInputStream(file); try al = (ArrayList)in.readObject(); catch (ClassNotFoundException e) al=null; in.close(); File file = new File( /查找 public Student find(int n) if(al.get(i).getNum()=n) return al.ge

8、t(i); return null;登陆界面及成绩管理的所有界面,同过创建StuC的对象,调用其方法实现成绩管理代码:import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Login extends JFrame private TextField f1; private TextField f2; private JButton b1; private JButton b2; private JButton b3; StuC scs=new StuC(); /登陆界面 public Login(

9、) Container cp=getContentPane();/容器 cp.setLayout(new GridLayout(3,1);/三行一列布局 Label l1=new Label(用户名 Label l2=new Label(密 码 Panel p1=new Panel(); Panel p2=new Panel(); Panel p3=new Panel(); f1=new TextField(10); f2=new TextField(10); f2.setEchoChar(*/回显字符为* b1=new JButton(登录 b2=new JButton(重置 b3=new

10、JButton(退出 p1.add(l1);/第一行添加label 1 p1.add(f1); p2.add(l2); p2.add(f2); p3.add(b1); p3.add(b2); p3.add(b3); cp.add(p1); cp.add(p2); cp.add(p3); b1.addActionListener(new Enter(); b2.addActionListener(new ReWrite(); b3.addActionListener(new Close(); class Enter implements ActionListener public void ac

11、tionPerformed(ActionEvent e) if(f1.getText().equals(yazhou)&(f2.getText().equals(123456) scs.read();/初始化,从文件读入信息 XueSheng frame1 = new XueSheng(); frame1.setBounds(200, 200, 300, 300); frame1.setVisible(true); else JOptionPane.showMessageDialog(null, 用户名或密码错误,请重新登录! class ReWrite implements ActionLi

12、stener f1.setText( f2.setText( f1.requestFocus(); class Close implements ActionListener JButton bt=(JButton)e.getSource(); if(bt=b3) System.exit(0);/主函数 程序开始 public static void main(String args) Login log=new Login(); log.setTitle(系统登录 log.setBounds(200, 200, 300, 300); log.setBackground(Color.blue)

13、; log.setVisible(true); /信息管理界面内部类 进行初始化和保存 class XueSheng extends JFrame implements ActionListener private JButton cx, zj, tc, sc,xg,tj; public XueSheng() Container c = this.getContentPane(); c.setLayout(new GridLayout(3, 1); c.setFont(new Font(true,Font.TRUETYPE_FONT,13); JPanel panel2 = new JPane

14、l(); JPanel panel1 = new JPanel(); JLabel label1 = new JLabel(欢迎进入成绩管理,SwingConstants.CENTER); label1.setFont(new Font( label1.setForeground(Color.blue); c.add(label1); /添加按钮 cx = new JButton(查询 panel2.add(cx); zj = new JButton(增加 panel2.add(zj); sc = new JButton(删除 panel2.add(sc); tc = new JButton(

15、 panel2.add(tc); xg = new JButton(修改 panel1.add(xg); tj = new JButton(统计 panel1.add(tj); c.add(panel2); c.add(panel1); cx.addActionListener(this); zj.addActionListener(this); sc.addActionListener(this); xg.addActionListener(this); tc.addActionListener(this); tj.addActionListener(this); this.setVisib

16、le(true); public void actionPerformed(ActionEvent e) if (e.getSource() = cx) Find f = new Find(); if(e.getSource()=zj) AddFI f = new AddFI(); if(e.getSource()=sc) Delet d = new Delet(); if(e.getSource()=xg) XiuGai x=new XiuGai(); if(e.getSource()=tc) shutDown(); if(e.getSource()=tj) Tongji t=new Ton

17、gji(); private void shutDown() scs.stor(); JOptionPane.showMessageDialog(null, 信息已保存 this.dispose(); /增加信息界面内部类,捕获文本框中信息创建Student对象,添加到Arraylist中,如果已存在该学号/给出提示信息,并重新添加。 class AddFI extends JFrame implements ActionListener private JTextField STNOText, SNAMEText, MAText, CHIText, JAVAText; private JBu

18、tton b1, b2, b3; private String STNO, SNAME,MAT, CHI, JAVA; public AddFI() super(添加学生信息 Container c2 = this.getContentPane(); c2.setLayout(new GridLayout(3, 1); JPanel center = new JPanel(new GridLayout(5, 2); JPanel low = new JPanel(new FlowLayout();, SwingConstants.CENTER);TRUE, Font.TRUETYPE_FONT

19、, 20); c2.add(label1); STNOText = new JTextField(30);/30列文本框 SNAMEText = new JTextField(30); CHIText = new JTextField(30); MAText = new JTextField(30); JAVAText = new JTextField(30); center.add(new JLabel(学号, SwingConstants.CENTER);/添加标签学号写在标签中间 center.add(STNOText);/添加文本框姓名 center.add(SNAMEText);语文

20、 center.add(CHIText);数学 center.add(MAText);java center.add(JAVAText); c2.add(center); b1 = new JButton(添加 b2 = new JButton(清除 b3 = new JButton( low.add(b1); low.add(b2); low.add(b3); c2.add(low); / 添加监听 b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); this.setBound

21、s(200, 200, 600, 400); this.setTitle( public void actionPerformed(ActionEvent e) if (e.getSource() = b1) try addFI(); catch (FileNotFoundException e1) e1.printStackTrace(); catch (IOException e1) if (e.getSource() = b2) clearForm(); if (e.getSource() = b3) this.dispose(); private void addFI() throws FileNotFoundException, IOException STNO = STNOText.getText(); SNAME = SNAMEText.getText(); CHI = CHIText.getText(); MAT = MAText.getText(); JAVA = JAVAText.getText(); if (STNO.length() = 0 | SNAME.length() = 0 | MAT.length() = 0 | JAVA.length() = 0 | CHI.length() = 0) JOptionPane.showM

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1