永发信息网

用JAVA构建一个Student 方法应怎么做?

答案:1  悬赏:60  手机版
解决时间 2021-04-23 10:34
  • 提问者网友:箛茗
  • 2021-04-22 21:05
用JAVA构建一个Student 方法应怎么做?
最佳答案
  • 五星知识达人网友:枭雄戏美人
  • 2021-04-22 22:44

我直接给你一个Student 类,里面有Student 方法:


public class Student {
private String name ;
private int computer_score;
private int English_score;
private int Maths_score;

public Student(String name,int computer_score,int English_score,int Maths_score){
this.name=name;
this.computer_score = computer_score;
this.English_score=English_score;
this.Maths_score = Maths_score;
}
public void setName(String name){
this.name=name;
}
public void setComputer_score(int computer_score){
this.computer_score=computer_score;
}
public void setEnglish_score(int English_score ){
this.English_score = English_score;
}
public void setMaths_score(int Maths_score ){
this.Maths_score = Maths_score;
}
public int getTotalScore( ){
return this.computer_score+this.English_score+this.Maths_score;
}
public void introduce ( ){
System.out.print("姓名:"+this.name+",总成绩为:"+getTotalScore());
}
}

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯