Building Software Systems I & II
&
Computer Fundamentals
By Thakdanai Khunsaen
OS : Ubuntu GNOME 17.04 64-bit
วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558
Lab3-Grade
void setup() {
size(400, 200);
int x = width/2, y = 70;
int space = 80;
int score = 99;
background(#0088CC);
fill(255);
textAlign(CENTER);
textSize(50);
text("Score = "+score, x, y);
grade(x, y+space, score);
}
void grade(int x, int y, int score) {
if (score <= 100 && score >= 80) {
text("Grade A", x, y);
} else if (score <= 79 && score >= 70) {
text("Grade B", x, y);
} else if (score <= 69 && score >= 60) {
text("Grade C", x, y);
} else if (score <= 59 && score >= 50) {
text("Grade D", x, y);
} else if (score < 50) {
text("Grade F", x, y);
textSize(15);
text("See you again next year.", x, y+20);
}
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น