在Java中编写程序,定义一个学生类,属性包括姓名,学号,语文成绩,数学成绩,英语成绩,方法包括输出数

2024年11月18日 04:46
有1个网友回答
网友(1):

return "name = " + name + " stuNum = " + stuNum + " chineseScore = " + chineseScore + " mathScore = " + mathScore + " englishScore = " + englishScore;}//设置姓名public void setName(String name){ this.name = name;}//设置学号public void setStuNum(String stuNum){ this.stuNum = stuNum;}/袜吵/设置语文成绩 public void setChineseScore(double chineseScore){ this.chineseScore = chineseScore;}//设置数学成绩 public void setMathScore(double mathScore){ this.mathScore = mathScore;}//告棚侍设置英语成绩 public void setEnglishScore(double englishScore){ this.englishScore = englishScore;}//求和唯总成绩public double getTotalScore(){ return chineseScore + mathScore + englishScore;}//求平均成绩