-->
当前位置:首页 > 题库

PROGRAMMING:Jmu-java-02 basic syntax-06-enumeration

Luz5年前 (2021-05-10)题库435
Define an enumeration type grade to represent the four grades of the examination, and the values include a, B, C, D and E
Write a function ` grade getgrade (int score)'To convert the score passed in to an enumeration type
>=90 and < = 100 return to a,
>=80 and < 90 return to B,
>=70 and < 80 return to C,
>=60 and < 70 return to d,
Other return e
#Main method
After entering the score, call the getgrade function to return the corresponding grade. Use switch to print different evaluations according to the grade
`Excellent Good Average Fair Poor`
And each output a comment, to call the following function
```
public static void printGradeInfo(Grade grade){
System.out.println("class name="+Grade.class);
System.out.println("grade value="+grade);
}
```
###Input example:
```in
ninety
eighty
seventy
sixty
```
###Output example:
```out
Excellent
class name=class Grade
grade value=A
Good
class name=class Grade
grade value=B
Average
class name=class Grade
grade value=C
Fair
class name=class Grade
grade value=D
```






answer:If there is no answer, please comment