import javax.swing.JOptionPane;
public class Student {
String xh,name;
int yy,math,yw,total;
Student(String xh1,String name1){
xh=xh1;
name=name1;
}
Student(String xh1,String name1,int yy1,int math1,int yw1){
xh=xh1;
name=name1;
yy=yy1;
math=math1;
yw=yw1;
}
public void display(){
String str=JOptionPane.showInputDialog("请输入英语成绩:");
yy=Integer.parseInt(str);
str=JOptionPane.showInputDialog("请输入数学成绩:");
math=Integer.parseInt(str);
str=JOptionPane.showInputDialog("请输入语文成绩:");
yw=Integer.parseInt(str);
JOptionPane.showMessageDialog(null,"学号:"+xh+"\n姓名:"+name+"\n数学:"+math+"\n英语:"+yy+"\n语文:"+yw+"\n总成绩"+total);
}
public void sum(){
total=yy+yw+math;
}
public static void main(String[] args) {
Student t1=new Student("xxx", "xxx");
t1.display();
}
}
littleOStar
相关分类