Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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/1979

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago