การตัดเกรด
int score=99;// score that you get
void setup() {
size(500, 500);
calculating(100,300);
showscore(100, 200);
}
void calculating(int cX,int cY) {
background(0);
textSize(40);
if (score>=80) {
text("Your grade is A .", cX, cY);
} else if (score>=75) {
text("Your grade is B+ .", cX, cY);
} else if (score>=70) {
text("Your grade is B .", cX, cY);
} else if (score>=65) {
text("Your grade is C+ .", cX, cY);
} else if (score>=60) {
text("Your grade is C .", cX, cY);
} else if (score>=55) {
text("Your grade is D+ .", cX, cY);
} else if (score>=50) {
text("Your grade is D .", cX, cY);
} else {
text("Your grade is F .", cX, cY);
}
}
void showscore(int x, int y) {//showscore
text("Your score is "+score+".", x, y);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น