วันอาทิตย์ที่ 1 พฤศจิกายน พ.ศ. 2558

Display each student record.

public class Students {
   private String name;
   private int ID;
   private int age;
   private int weight;
   private int height;
 
   public Students(String name, int ID, int age, int weight, int height){
      this.name = name;
      this.ID = ID;
      this.age = age;
      this.weight = weight;
      this.height = height;
   }
 
   public void display(){
     System.out.println( "Name:"+this.name );
     System.out.println("ID: " +this.ID);
     System.out.println("Age: " +this.age);
     System.out.println("Weight: " +this.weight);
     System.out.println("height: " +this.height);
     System.out.println();
   }
 
   public static void main(String[] args) {
      Students a = new Students ("Gun", 32075, 26, 70, 174);
      Students b = new Students ("Rit", 32078, 25, 60, 170);
      Students c = new Students ("Frame", 32080, 19, 58, 173);
      Students d = new Students ("Boat", 32057, 16, 65, 168);
     
      Students [] data = {a, b, c, d};
      display(data);
   }
 
   public static void display(Students [] data){
      int i = 0;
      while(i < data.length){
        data[i].display();
        i = i + 1 ;
      }
   }
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

Link Video Presentation Resort Managemant System Project.

Video Presentation Resort Managemant System Project. จัดทำโดย พากษ์เสียง: คุณาสิน  ทองมณี  5801012620011 ลำดับภาพ: สุพิชชา  ศรีศิริ...