Write a program that requires the user to enter a
An integer representing the test score of a course, followed by a procedure
"
inferior lattice
"
,
"
Pass
"
,
"
in
"
,
"
Liang
"
,
"
Excellent
"
the conclusion.
First, the program source code
20151111
20142973 Wei Yao
Trycatch Statements
import Java.util.Scanner;
Public class Try_trycatch {
Public Static void Main (string[] args) {
TODO auto-generated Method stub
System. out. println ("Please enter student results (Arabic numerals):");
Scanner in = new Scanner (System. in);
Try
{
Double a=in.nextdouble ();
int a=in.nextint ();
if (a<60)
System. out. println ("failed." ");
if (a>=60&&a<70)
System. out. println ("Pass". ");
if (a>=70&&a<80)
System. out. println ("Medium. ");
if (a>=80&&a<90)
System. out. println ("Liang. ");
if (a<101&&a>=90)
System. out. println ("excellent. ");
}
Catch (Exception b)
{
System. out. println ("wrong input! ");
}
}
}
Second, the operation
The seventh chapter of the Classroom Programming topic