You have the String marks="60";
You want to use marks in in the method grading(int mk) which receives the marks and the return the corresponding grade. Which processing must be doe to marks for it to work ?
protected int grading(int mk) {
int grade;
if(mk > 80 && mk <= 100) {
grade = 1;
}else if(mk >= 75 && mk < 80) {
grade = 2;
}else if(mk >= 70 && mk < 75) {
grade = 3;
}else if(mk >= 60 && mk < 70) {
grade = 4;
}else if(mk >= 55 && mk < 60) {
grade = 5;
}else if(mk >= 50 && mk < 55) {
grade = 6;
}else if(mk >= 45 && mk < 50) {
grade = 7;
}else if(mk >= 40 && mk < 45) {
grade = 8;
}else if(mk >= 0 && mk < 40) {
grade = 9;
}else {
grade = 9;
}
return grade;
}
Comments
Leave a comment