A simple learner-state converter
Import Java.util.scanner;public class Student {public static void main (string[] args) {Student.run ();} public static void Run () {System.out.println ("************** Welcome to Learner State Translator ***************"); Scanner sc = new Scanner (system.in), while (true) {System.out.println ("Enter the first English letter of the learner's status:");//Gets the status of the learner entered by the user the control Word, String str = Sc.next (); switch (str) {case ' E ': Case "E": System.out.println ("excellent"); System.out.println ("Do you want to continue?" (y/n);//Gets the word entered by the user, string num = Sc.next ();//Determine if the user is continuing to enter? Switch (num) {case "Y": Continue;case "n": System.exit (0);d efault:System.out.println ("Input error, please reenter");} Case "G": Case "G": System.out.println ("good"); System.out.println ("Do you want to continue?" (y/n);//Gets the word entered by the user string num1 = Sc.next ();//Determine if the user is continuing to enter? Switch (NUM1) {case "Y": Continue;case "n": System.exit (0);d efault:System.out.println ("Input error, please reenter");} Case ' s ': Case "S": System.out.println ("medium"); System.out.println ("Do you want to continue?" (y/n);//Gets the word entered by the user string num2 = Sc.next ();//Determine if the user is continuing to enter? Switch (num2) {case "Y": Continue;case "n": System.exit (0);d Efault:System.out.prinTLN ("Input error, please re-enter");} Case ' F ': Case "F": System.out.println ("unqualified"); System.out.println ("Do you want to continue?" (y/n);//Gets the word entered by the user string num3 = Sc.next ();//Determine if the user is continuing to enter? Switch (num3) {case "Y": Continue;case "n": System.exit (0);d efault:System.out.println ("Input error, please reenter");} Case "H": Case "H": System.out.println ("input error, unable to convert"); System.out.println ("Do you want to continue?" (y/n);//Gets the word entered by the user string num4 = Sc.next ();//Determine if the user is continuing to enter? Switch (NUM4) {case "Y": Continue;case "n": System.exit (0);d efault:System.out.println ("Input error, please reenter");} DEFAULHT:SYSTEM.OUT.PRINTLN ("input error"); System.out.println ("Do you want to continue?" (y/n);//Gets the word entered by the user string num5 = Sc.next ();//Determine if the user is continuing to enter? Switch (NUM5) {case "Y": Continue;case "n": System.exit (0);d efault:System.out.println ("Input error, reenter");}}}}
This is the stupidest thing I wrote when I was in the exam, not recommended. Do you want to continue? Can be written as a method below, and then call the above directly below the SANFA on it.
Note: The input is all characters, so double quotation marks are added.
I just forgot to add double quotation marks when I was in the exam, only the most stupid way to write, so my blog sent to remind me of the time
Some summaries and self-reminders of basic Java exams