Building Software Systems I & II
&
Computer Fundamentals
By Thakdanai Khunsaen
OS : Ubuntu GNOME 17.04 64-bit
วันอาทิตย์ที่ 30 สิงหาคม พ.ศ. 2558
Lab2-BMI(Function)
int posX = 25, posY = 50;
int space = 50;
float high = 173;
float weight = 60;
void setup(){
size(450,200);
background(#99FFFF);
float BMI = cal_BMI(high,weight);
textSize(30);
fill(#008B00);
text("Weight = "+weight+" kg",posX,posY);
text("Height = "+high+" cm",posX,posY+space);
fill(#FF0000);
text("BMI = "+BMI,posX,posY+space*2);
}
float cal_BMI(float high,float weight){
float BMI;
float highM = high/100;
BMI = weight/(highM*highM);
return BMI;
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น