วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558
Lab 3 : Calculate grade from score
String grade;
void setup(){
size(400,300);
background(#000000);
float score=79;
cal_grade(score);
}
void cal_grade(float score){
int x=50;
int y=100;
textAlign(LEFT);
textSize(30);
fill(#ffffff);
if(score<50){
grade="F";
}else if(score>=50 && score < 55){
grade="D";
}else if(score>=55 && score < 60){
grade="D+";
}else if(score>=60 && score < 65){
grade="C";
}else if(score>=65 && score < 70){
grade="C+";
}else if(score>=70 && score < 75){
grade="B";
}else if(score>=75 && score < 80){
grade="B+";
}else if(score>=80 && score <=100){
grade="A";
}
textAlign(LEFT);
fill(#ffffff);
text("Your score = "+score,x,y);
text("You get grade "+grade,x,y+100);
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น