Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please explain the pattern and why we used Integer . parseInt ( mr . group (3) ) in 12.5 and when to use it
Please explain the pattern and why we used "Integer . parseInt ( mr . group (3) ) " in 12.5 and when to use it and when not.
12.4 Fill in the missing code String in - "Deadpoolu891-22-3954 "+ "Wadeu113-24-5566 "; Scanner s - new Scanner (in); while (s.hasNextLine)) String pattern = if(s.find InLine (pattern) . != nu11) { MatchResult mr - s.match (); int a = Integer.parseInt( int b = Integer.parseInt( int c = Integer.parseInt( String d = . mr.group (2) mr.group (3) mr.group (4) ) ); ): mr.group (1) System . out. print f ("Name : u%s , ussn :u%d-%d-%d%n" , d, a, b, c) ; J s.nextLine (); // output: Name: Deadpool, ssn: 891-22-3954 Name: Wade, ssn: 113-24-5566 12.5 Fill in the missing code String in = "MoDuJan, 2,?1982 WeduAuEu14,u1979 "; Scanner s new Scanner (in); while (s.hasNextLine)) String pattern - -- if (s.findInLine (pattern) !- null) [ MatchResult mr - s.match ) String weekday . String month = . int day- mr . group (1) mr.group (2) Integer.parseInt (mr.group (3)) Integer .parseInt (mr . group (4)) nt year - System . out . printf "Date :uZsu%d/Xs/%d%n", weekday, day , month , year) ; else t System. out.println ("Incorrect") j s.nextLine O; // output: Date: Mon 2/Jan/1982 Date: Wed 14/Aug/1979Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started