学生信息管理系统小程序,还需要设定管理人员身份与其对应的管理界面及信息量,功能界面也还没有独立设定出来,想要在接下来的自学中独立完成。但还是想请前辈们指教一下怎么美化界面,对这一块很陌生,老是初始的灰框,感觉审美疲劳了都。:L:L
Student 类
public class Student
{
private int id;
private int age;
private int score;
private String name;
public Student()
{
}
public Student(int id, int age, int score, String name)
{
this.id = id;
this.age = age;
this.score = score;
this.name = name;
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public int getAge()
{
return age;
}
public void setAge(int age)
{
this.age = age;
}
public int getScore()
{
return score;
}
public void setScore(int score)
{
this.score = score;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String toString()
{
return "学号:" + id + " 姓名:" + name + " 年龄:" + age + " 成绩:" + score;
}
}
Manager类
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class Manager
{
private List<Student> list;
public Manager(List<Student> list)
{
this.list = list;
}
public List<Student> getList()
{
return list;
}
public void setList(List<Student> list)
{
this.list = list;
}
//添加学生
public void add(Student s)
{
list.add(s);
}
//根据学生学号返回学生年龄
public int search(int id)
{
for(Iterator<Student> iter = list.iterator(); iter.hasNext();)
{
Student s = iter.next();
if(s.getId() == id)
{
return s.getAge();
}
}
return -1;
}
//删除学生
public void remove(int id)
{
for(Iterator<Student> iter = list.iterator(); iter.hasNext();)
{
Student s = iter.next();
if(s.getId() == id)
{
list.remove(s);
}
}
}
//计算总成绩
public int allScore()
{
int score = 0;
int temp = 0;
for(Iterator<Student> iter = list.iterator(); iter.hasNext();)
{
Student s = iter.next();
temp = s.getScore();
score += temp;
}
return score;
}
//修改成绩
public void update(int id)
{
for(Iterator<Student> iter = list.iterator(); iter.hasNext();)
{
Student s = iter.next();
if(s.getId() == id)
{
s.setScore(s.getScore() + 10);
}
}
}
}
}
|
|