love

วันอังคารที่ 8 กันยายน พ.ศ. 2558

Lab3 - Grade Calculation

//K. Thanapat
void setup(){
  size(600,300);
  background(255);
  int score = 70;
  fill(0);
  textSize(40);
  text("Test Result" ,200 ,70);
  text("Mr.Thanapat Klayjamlang" ,50 ,130);

//กำหนดเงื่อนไข

    //Error
  if(score<0 score="">100){
    if(score>50){
      text("Error (Too much Scores)" ,50 ,200) ;
    }else{
      text("Error (Too few Scores)" ,50 ,200);
    }
  }
  else{
      //grade
    if(score>=80){
      text("You have grade A" ,50 ,200);
    }else if(score>=70&&score<=79){
      text("You have grade B" ,50 ,200);
    }else if(score>=60&&score<=69){
      text("You have grade C" ,50 ,200);
    }else if(score>=50&&score<=59){
      text("You have grade D" ,50 ,200);
    }else{
      text("You have grade F" ,50 ,200);
    }
  }
}

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

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