Java Basics: Student status queries

Source: Internet
Author: User
Tags chr

1  PackageKaoshi;2 /*3 * Student Status Enquiry4 * @ Longing for life5 * @ time: 2017, 3, 76  */7 ImportJava.util.Scanner;8 9  Public classStudentstate {Ten      Public Static voidMain (string[] args) { One         Booleanflag=false; A          while(true){ -Scanner scan=NewScanner (system.in); -System.out.print ("Please enter the first English letter of the learner status:"); theString input =scan.nextline (). toUpperCase (); -             CharCHR = Input.tochararray () [0]; -             Switch(CHR) { -              CaseE: +System.out.println ("excellent"); -flag=enquire (flag); +                  Break; A              CaseG: atSystem.out.println ("Good"); -                  -flag=enquire (flag); -                  Break; -              CaseS: -System.out.println ("Medium"); inflag=enquire (flag); -                  Break; to              CaseF: +System.out.println ("Unqualified"); -flag=enquire (flag); the                  Break; *  $             default:Panax NotoginsengSYSTEM.OUT.PRINTLN ("Input error, unable to convert"); -flag=enquire (flag); the                  Break; +             } A             if(flag==true){ theSystem.out.println ("Exit System!")); +System.exit (-1); -             } $         }     $     } -     /* - * Select whether you want to continue querying the      */ -      Public Static BooleanEnquire (Booleanflag) {Wuyi          while(true){ theScanner scan=NewScanner (system.in); -System.out.print ("\t\n"); WuSystem.out.print ("Do you want to continue?") (y/n) "); -String INPUT6 =scan.nextline (); AboutSystem.out.print ("\t\n"); $INPUT6 =input6.touppercase (); -             CharCHR6 = Input6.tochararray () [0]; -             if(chr6== ' N '){ -flag=true; A                returnFlag; +             } the             Else if(chr6== ' Y '){ -                 returnFlag; $             } the             Else{ theSYSTEM.OUT.PRINTLN ("Input error, re-enter!") "); the             } the             } -     } in}

Java Basics: Student status queries

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.