วันจันทร์ที่ 2 พฤศจิกายน พ.ศ. 2558

Find student BMI.

public class Student{
  private String name;
  private int ID;
  private int age;
  private int weight;
  private int height;

  public Student(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 String get_name(){
        return this.name;
  }

  public int get_ID(){
        return this.ID;
  }

  public int get_age(){
        return this.age;
  }

  public int get_weight(){
        return this.weight;
  }

  public int get_height(){
        return this.height;
  }

  public static void main(String[] args){
    Student a = new Student("Gun" , 32075, 26, 80, 174);
    Student b = new Student("Rit" , 32078, 25, 70, 170);
    Student c = new Student("Frame" , 32080, 19, 58, 173);
    Student d = new Student("Coffee"  , 32057, 18, 50, 168);
    Student e = new Student("Boat" , 32087, 16, 60, 165);
 
    Student [] data = {a,b,c,d,e};  
    BMI(data);  
  }

   public static void BMI(Student [] data){
      int i = 0;
      float BMI = 0;
      while(i < data.length){
        BMI = data[i].get_weight()*100*100/((data[i].get_height()*(data[i].get_height())));
        System.out.println(data[i].get_name() +" BMI value = " +BMI);
        i += 1 ;
      }
   }
}

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

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

Link Video Presentation Resort Managemant System Project.

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