วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558

lab3score

void setup() {
  size(500, 500);
  background(0);
  fill(255);
  textSize(30);
  grade(60);
}
void grade(float score) {
  float x = 250;
  float y = 200;
  text("Your score = "+score, x-200, y-100);
  text("Get", x-200, y);
  text("Grade", x-200, y+100);

  if (score < 0) {
    text("Error", x, y);
    text("Error", x, y+100);

  } else if (score < 50) {
    text("F", x, y);
    text("-", x, y+100);

  } else if (score >= 50 && score < 55) {
    text("D", x, y);
    text("1.00", x, y+100);

  } else if (score >= 55 && score < 60) {
    text("D+", x, y);
    text("1.50", x, y+100);

  } else if (score >= 60 && score < 65) {
    text("C", x, y);
    text("2.00", x, y+100);

  } else if (score >= 65 && score < 70) {
    text("C+", x, y);
    text("2.50", x, y+100);

  } else if (score >= 70 && score < 75) {
    text("B", x, y);
    text("3.00", x, y+100);

  } else if (score >= 75 && score < 80) {
    text("B+", x, y);
    text("3.50", x, y+100);

  } else if (score >= 80 && score <= 100) {
    text("A", x, y);
    text("4.00", x, y+100);

  } else if (score > 100) {
    text("Error", x, y);
    text("Error", x, y+100);
  }
}

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

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