static double[] Grades = new double[4]; static boolean isPass;
public static void Firstchoose() {
Scanner in = new Scanner(System.in); System.out.print("Enter a number of a matrix: "); int a = in.nextInt(); System.out.print("The rank: "); int b = in.nextInt(); System.out.print("The line: "); int c = in.nextInt(); System.out.println("----------------first level-----------------"); int num = 0; Outer: for (int i = 1; i <= a; i++) { for (int j = 1; j <= a; j++) { num++; if (i == b && j == c) { System.out.println("The " + i + " rank, the " + j + " line " + "whose number is " + num + " please go to join the exam"); break Outer; } } } System.out.println("The first level question:"); System.out.println("There is a well 10 meters deep," + " a snail crawls 2 meters during the day, and slides 1 meter at night, " + "asking how many days it will climb to the wellhead."); System.out.println("Please enter the answer:"); int inday = in.nextInt(); int distance = 0; int day = 1; while (true) { distance += 2; if (distance >= 10) { break; } distance -= 1; day++; } if (day == inday) System.out.println("You can do next level"); else { System.out.println("Sorry, you have to stop here"); System.exit(0); } }
public static void getGrades() {
System.out.println("------------second level------------------"); Scanner input = new Scanner(System.in); System.out.println("Please enter the fullmark of the each subject mark: "); double Fullmark = input.nextDouble(); int FailSum = 0; double TotalFullmark = Fullmark * 3; boolean b = true; do { System.out.println("Please enter your Chinese, Math, English grades: "); for (int i = 1; i <= 3; i++) { Grades[i] = input.nextDouble(); Grades[0] += Grades[i]; } for (int i = 1; i <= 3; i++) { if (Grades[i] >= 60 && Grades[i] <= Fullmark) switch (i) { case 1: System.out.println("The Chinese grades is:" + Grades[i]); break; case 2: System.out.println("The Math grades is" + Grades[i]); break; case 3: System.out.println("The English grades is" + Grades[i]); break; } else if (Grades[i] < 60) { switch (i) { case 1: System.out.println("The Chinese grades is FAILED"); FailSum++; break; case 2: System.out.println("The Math grades is FAILED"); FailSum++; break; case 3: System.out.println("The English grades is FAILED"); FailSum++; break; } } else if (Grades[i] > Fullmark) { System.out.println("Your grades is unavailable,Please enter again"); b = false; Grades[0] = 0; break; } b = true; } } while (b == false); System.out.println("The total grades is " + Grades[0]); if (FailSum > 0 || Grades[0] < (TotalFullmark * 0.75)) { isPass = false; System.out.println("Sorry, we can't use you because of your grades have at least one " + "FAILED or Totalmark lower than 75 percent of the TotalFullmark"); System.exit(0); } else { isPass = true; System.out.println("Congratulations! You have passed our test!"); System.out.println( "--------------Please register your personal information, but first, we have to check your BMI------------"); } }
public static void BMI(double n1, double n2) {
final double KILOGRAMS_PER_POUND = 0.45359237; final double METERS_PER_INCH = 0.0254; double weightInKilograms = n1 * KILOGRAMS_PER_POUND; double heightInMeters = n2 * METERS_PER_INCH; double bmi = weightInKilograms / (heightInMeters * heightInMeters); System.out.println("BMI is " + bmi); if (bmi < 18.5) { System.out.println("Underweight"); System.out.println("Sorry, you're too thin, we can't use you."); System.exit(0); } else if (bmi < 25) System.out.println("Normal"); else if (bmi < 30) { System.out.println("Overweight"); System.out.println("Please pay attention to your body!"); } else { System.out.println("Obese"); System.out.println("Sorry, you're too thin, we can't use you."); System.exit(0); } }
public static void main(String[] args) {
ChoosePeople.Firstchoose(); getGrades(); // BMI Scanner in = new Scanner(System.in); System.out.print("Please enter weight in pounds: "); double weight = in.nextDouble(); System.out.print("Please enter height in inches: "); double height = in.nextDouble(); BMI(weight, height); Scanner inp = new Scanner(System.in); System.out.print("Please set your name: "); String name = inp.nextLine(); System.out.print("Please set your password: "); String pass = inp.nextLine(); System.out.print("****************"); System.out.print("\n----Welcome-----"); System.out.print("\n------to--------"); System.out.print("\n------our-------"); System.out.print("\n----Company!----"); System.out.print("\n****************"); System.out.print("\nName: "); String name1 = inp.nextLine(); System.out.print("Password: "); String pass1 = inp.nextLine(); if (pass1.equals(pass)) System.out.println("Password is right! "); else System.out.println("Password is wrong! Please enter it again! "); // Birthday Scanner input = new Scanner(System.in); System.out.print("Please enter your ID card: "); String num = input.nextLine(); String year = null, month = null, day = null; if (num.length() == 18) { year = (String) num.subSequence(6, 10); month = (String) num.subSequence(10, 12); day = (String) num.subSequence(12, 14); System.out.println("Your birthday is: " + year + " year " + month + " month " + day + " day "); } else System.out.println("Please enter the correct ID number"); // Mobile number Scanner inpu = new Scanner(System.in); System.out.print("Please enter your moblie number: "); String number = inpu.nextLine(); String number1 = number.substring(0, 3); System.out.print("Your mobile number is : " + number); if (number1.equals("134") || number1.equals("135") || number1.equals("136") || number1.equals("137") || number1.equals("138") || number1.equals("139") || number1.equals("147") || number1.equals("150") || number1.equals("151") || number1.equals("152") || number1.equals("158") || number1.equals("182") || number1.equals("183") || number1.equals("159") || number1.equals("187") || number1.equals("188") || number1.equals("178")) System.out.print("\nThe operator of the mobile phone is CMCC"); else if (number1.equals("133") || number1.equals("153") || number1.equals("180") || number1.equals("181") || number1.equals("189") || number1.equals("177") || number1.equals("173") || number1.equals("149")) System.out.print("\nThe operator of the mobile phone is CTCC"); else if (number1.equals("130") || number1.equals("131") || number1.equals("132") || number1.equals("145") || number1.equals("155") || number1.equals("156") || number1.equals("185") || number1.equals("186") || number1.equals("176") || number1.equals("175")) System.out.print("\nThe operator of the mobile phone is CUCC"); System.out.println("So, this is all your own information: "); BMI(weight, height); System.out.println("Your ID number is: " + num); System.out.println("Your birthday is: " + year + " year " + month + " month " + day + " day "); System.out.println("Your mobile number is : " + number); System.out.println("The operator of the mobile phone is CUCC"); }