void setup()
{
size(500,500);
}
void draw()
{
background(0);
textSize(30);
CalGrade(79);
}
void CalGrade(int valScore)
{
text("My Score = "+valScore,width/3,height/3);
if(valScore <= 100 && valScore >= 80)
{
text("Grade A",width/3,height/2) ;
}
else if(valScore <= 79 && valScore >= 70)
{
text("Grade B",width/3,height/2) ;
}
else if(valScore <= 69 && valScore >= 60)
{
text("Grade C",width/3,height/2) ;
}
else if(valScore <= 59 && valScore >= 50)
{
text("Grade D",width/3,height/2) ;
}
else
{
text("Grade F",width/3,height/2) ;
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น