วันเสาร์ที่ 29 สิงหาคม พ.ศ. 2558

LAB 2 BMI function

void setup(){
  size(400,800);
  background(0);
  textSize(20);
  BMI(57,171,10,10);//call function
  text("your BMI is "+Bmi(57,171),10,300);
}


//====make function find BMI======
void BMI(float weight,float hight,int X,int Y)//x and y mean a point of text
{
  float BMI= weight/((hight/100)*(hight/100));
  text("Your weight is " +weight,X,Y+20);
  text("Your hight is " +hight,X,Y+50);
  text("Your BMI is " +BMI,X,Y+80);
}

 
float Bmi(float weight,float hight)
{
  float BMI= weight/((hight/100)*(hight/100));
  return BMI;
}

 
 

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

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