The seventh chapter of the Classroom Programming topic

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.