用java写程序,定义一个student类,包含的内容如下。成员变量:学号、姓名、性别、班干部否、数学、语文、

如题所述

第1个回答  推荐于2018-06-17
public class Student {

/**
* @param args
*/
boolean master; //定义成员变量
int num;
String name,sex;
double math,chinese,english,score=0.0,average=0.0;

Student(int num,String name, String sex, boolean ma, double math, double chinese, double english ){ //构造方法
this.num = num;
this.name = name;
this.sex = sex;
this.master = ma;
this.math = math;
this.chinese = chinese;
this.english = english;
}

void score(){ //计算总分方法
score= math+chinese+english;
System.out.println(score);
}
void ave(){ //计算平均分方法
average = score/3;
System.out.println(average);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Student s = new Student(101,"kit","male",true,90.0,90.0,90.0); //创建对象
s.score(); //调用方法
s.ave();
}

}本回答被网友采纳
第2个回答  推荐于2018-03-20
public class Student{
String number;
String name;
String sex;
boolean isLeader;
float math;
float yuwen;

public Student(String number,String name,String sex, boolean isLeader,
float math,float yuwen){
this.number=number;
this.....
....
}
}本回答被提问者和网友采纳
第3个回答  2012-03-31
public class Student{
int studentId;
String Name;
String gender;
boolean isGender;
int manthScore;
int chaneseScore;
}

用java写程序,定义一个student类,包含的内容如下。成员变量:学号、姓 ...
public class Student { \/ param args \/ boolean master; \/\/定义成员变量 int num;String name,sex;double math,chinese,english,score=0.0,average=0.0;Student(int num,String name, String sex, boolean ma, double math, double chinese, double english ){ \/\/构造方法 this.num = n...

用java写程序,定义一个student类,包含成员变量有学号、姓名、性别、班...
public class Student {\\x0d\\x0a\\x0d\\x0a\/**\\x0d\\x0a * @param args\\x0d\\x0a *\/\\x0d\\x0aboolean master; \/\/定义成员变量\\x0d\\x0aint num;\\x0d\\x0aString name,sex;\\x0d\\x0adouble math,chinese,english,score=0.0,average=0.0;\\x0d\\x0a\\x0d\\x0aStudent(int ...

Java 定义一个Student类,包含内容如下: 成员变量——学号,姓名,性别,班...
import java.util.Scanner;public class Student { public static void main(String[] args) { Student student = new Student(); student.input(); float sum = student.sum(); float avg = student.avg(); System.out.println("The "+student.getName()+"'s"+" sum is...

Java定义一个Student类,包括学号、姓名、性别、班级、出生日期
public class Student { private String sno; \/\/学号 private String name; \/\/姓名 private String sex; \/\/性别 private String calss; \/\/班级 private String major; \/\/专业 public String getSno() { return sno;} public void setSno(String sno) { this.sno = sno;} public String getNam...

怎样用JAVA设计学生类Student,包含“学号、班级、姓名、年龄、成员...
这个很简单呀,要自己试着去写。\\r\\npublic class Students {\\r\\n\\tprivate String ID; \/\/学号\\r\\n private String classId; \/\/班级\\r\\n private String name; \/\/姓名\\r\\n\\tprivate int age; \/\/年龄\\r\\n public Students(String ID,String classId,String name,in...

JAVA编程 定义一个学生类,数据成员包括:学号,姓名,年龄,成绩;成员函数...
public static void main(String[] args) { Scanner sc = new Scanner(System.in);System.out.println("请输入学生个数:");int n = sc.nextInt();Student [] ss = new Student[n];for(int i=0;i<n;i++){ Scanner sca = new Scanner(System.in);Student s = new Student();Syste...

Java题求解: 设计一个学生类,包括变量(学号、班号、姓名、性别、年龄...
完整代码如下,复制到eclipse中运行:public class StuExam {private String snum;\/\/ 学号private String cnum;\/\/ 班号private String name;\/\/ 姓名private char sex;\/\/ 性别private int age;\/\/ 年龄\/\/ get\/set方法用来获取\/设置学生实例对象的信息public String getSnum() {return snum;}public ...

用JAVA编写一个学生类Student的程序
学生类:public class Student { private String num;\/\/学号 private String name;\/\/姓名 private String sex;\/\/性别 private int age;\/\/年龄 public Student(String num,String name,String sex,int age){ this.num = num;this.name = name;this.sex = sex;this.age = age;} public String ...

java编程定义一个学生类Student,成员变量有学号,姓名,性别,身高,体重...
public class DateDemo {public static void main(String[] args) {java.util.Vector<Student> vs = new java.util.Vector<Student>();for(int i = 0; i < 10; i++){vs.add(new Student(i,"张三"+i,"男",+1.72,65.03));}java.util.Iterator<Student> it = vs.iterator();while...

java定义一个学生类要求学号,姓名,年龄,三个成员变量
class Student{private int STU_NUM;private String STU_NAME;private int STU_AGE;public Student(int NUM,String NAME){this.STU_NAME=NAME;this.STU_NUM=NUM;}public Student(int NUM,String NAME,int AGE){this.STU_NAME=NAME;this.STU_NUM=NUM;this.STU_AGE=AGE;}} ...

相似回答