编写一程序,用哈希表实现学生成绩单的存储与查询

来源:百度知道 编辑:UC知道 时间:2024/06/14 00:24:06
public HashTest() throws HeadlessException {
super("学生成绩管理");
ht = new Hashtable();
lblsearchbyidorname = new JLabel("学号:");
txfidorname = new JTextField(20);
lblno = new JLabel("学号");
lblname = new JLabel("姓名");
lblscore = new JLabel("分数");
addno = new JTextField(10);
addname = new JTextField(12);
addscore = new JTextField(10);
btnsearchbyidorname = new JButton("查找-->");
btnadd = new JButton("新增");
btndelete = new JButton("删除");
colnames = new Vector();
colnames.add("学号");
colnames.add("姓名");
colnames.add("成绩");
data = new Vector();
reader = new JTable(new ReaderTableModel(data,colnames));
reader.setPreferredSize(new D

import java.util.Hashtable;

声明引用了吗?

给你完整代码

学生类Student,代码如下:

class Student{

private String no;

private String name;

private Integer score;

public String getNo() {

return no;

}

public void setNo(String no) {

this.no = no;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public Integer getScore() {

return score;

}

public void setScore(Integer score) {

this.score = score;

}

public String toString(){

return "学号:" + no + " 姓名:" + name + " 成绩:" + score;

}

}

主类H