วันอาทิตย์ที่ 30 สิงหาคม พ.ศ. 2558

Lab 3 : Calculate grade from score

float score=65.8;
void setup() {
  size(300, 300);
}
void draw() {
  show_score(5,100);
  calculate_grade(70,200);
}
void show_score(int x,int y){
  fill(0);
  textSize(30);
  text("YOUR SCORE : "+score,x,y);
}
void calculate_grade(int x,int y) {
  fill(0);
  textSize(30);
  if (score >= 80 && score <= 100) {
    text("YOU GET A",x,y);
  } else if (score >= 70 && score <= 79) {
    text("YOU GET B",x,y);
  } else if (score >= 60 && score <= 69) {
    text("YOU GET C",x,y);
  } else if (score >= 50 && score <= 69) {
    text("YOU GET D",x,y);
  } else if (score >= 0 && score <= 49) {
    text("YOU GET F",x,y);
  } else {
    text("NOT WORKING...",x,y);
  }
}


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

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