The code is almost done however when I run it skips line 53 and… Image transcription textMain.java X ) statuses.java Dgenders.java Gender.
The code is almost done however when I run it skips line 53 and… Image transcription textMain.java X ) statuses.java Dgenders.java Gender.java World.javafirstproj.java 101 Enum.cla… Show more… Show moreImage transcription textlease again”) ; } }while (ageres =!ageres); // method will run untilcondition is met System. … Show more… Show moreThe code is almost done however when I run it skips line 53 and prints the results automatically without letting me enter my address. Also how do I put conditional statements with enums? line 43-45 , 48-50 conists enum. I want to eliminate the error on the terminal and just print “Invalid input” when the user input doesn’t match my enum. here’s the code:*MAIN*import java.util.Scanner;//main classpublic class Main {public static void main(String[] args) { Scanner sc = new Scanner(System.in); String name; String ge;//new object String stat; // new object String fm; String welcome = (“Here’s your information” + “n”); boolean ageres; // boolean statement para sa regex. boolean nameres; boolean gres; do { System.out.print(“Enter your name : “); // user input name = sc.nextLine(); // it scans and store the user input// if name will match to numbers this method/function will run until condition met nameres = name.matches(“D+”); if (nameres == false) { System.out.println(“Name invalid! please try again!”); } } while (nameres =! nameres); do { System.out.print(“Enter your age : “); // age user input ge = sc.nextLine(); // scan stores the user input. ageres = ge.matches(“[0-9]{2}”);// experiment lang sir user input should be 2 digits then number form if(ageres == false){ // if false si ageres mag loop. System.out.println(“age limit is 99! Please try again”); } }while (ageres =! ageres); // method will run until condition is met System.out.println(“Enter Gender : Male or Female”); // first print fm = sc.next(); // stores user input genders g = genders.valueOf(fm); System.out.println(“Civil Status : Single | Married | Divorced | Separated | Widowed”); // user input stat = sc.next(); // stores user input statuses s = statuses.valueOf(stat); System.out.println(“Enter address : “); // first print String ad = sc.nextLine(); // prints all the output from subclasses System.out.println(welcome); System.out.println(“Name : ” + name); // prints the output from subclass Name. System.out.println(“Age : ” + ge); // prints the output from subclass Age. System.out.println(“Gender : ” + g); // prints the output from subclass Gender System.out.println(“Civil Status : ” + s);// prints the output from subclass Status System.out.println(“Address : ” + ad);// prints the output from subclass Status }} ENUM FOR LINE 48-50:public enum statuses { // enum// list of enumSingle,Married,Divorced,Separated,Widowed;} ENUM FOR LINE 43-45:public enum genders { //enum// enum listsFemale,Male;} Computer Science Engineering & Technology Java Programming COMPRO (F0031) Share QuestionEmailCopy link


