暑假里的第八篇Java

日期:2018.9.1

博客期:008

星期六

  这几天刚到学校,Java方面写的少了!目前在做老师头放假前发布的那一套题目,就是哪个Java程序测试卷。至于自己能不能都做出来我自己心里十分清楚!今天就着做出来的一部分题目分享一下!首先是Student类:

package testforthis;
public class student {
 //=====《数据区》
 //学号
 protected String stunumber;
 //名字
 protected String name;
 //性别
 protected boolean sex;
 //年龄
 protected int age;
 //分数
 protected double score;
 //=====《set函数区》
 public void set_stunumber(String x){
  stunumber = x ;
 }
 public void set_name(String x){
  name = x ;
 }
 public void set_sex(boolean x){
  sex = x ;
 }
 public void set_age(int x){
  age = x ;
 }
 public void set_score(double x){
  score = x ;
 }
 //=====《get函数区》
 public String get_stunumber(){
  return stunumber;
 }
 public String get_name(){
  return name;
 }
 public boolean get_sex(){
  return sex;
 }
 public int get_age(){
  return age ;
 }
 public double get_score(){
  return score;
 }
 //=====《构造函数区》
 public student(String stunumber_s,String name_s,int age_s,boolean sex_s,double score_s){
  stunumber = stunumber_s ;
  name = name_s ;
  age = age_s ;
  sex = sex_s ;
  score = score_s ;
 }
 //=====《主函数区》
 public static void main(String args[]){
  student s3 = new student("20181824","Mar",18,true,89.5);
  System.out.println(s3.get_name()+" 的得分是 "+s3.get_score());
 }
}
  再者是第二个,一会儿发布

猜你喜欢

转载自www.cnblogs.com/onepersonwholive/p/9571567.html