Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

JAVA - - The code distributed with Lectures 18 and 19 on March 1 and 3 contains ScanSupport.nextName() for pulling a name from the input line without...

JAVA - - The code distributed with Lectures 18 and 19 on March 1 and 3 contains ScanSupport.nextName() for pulling a name from the input line without crossing line boundaries the way sc.next() does. The code continues to use sc.nextFloat() , though, and as a result, it sees nothing wrong with this input:

road A B1.5 -- this is on the next line!

a) Give a regular expression that recognizes floating-point numbers such as 1, 12, 12.3, 12.34 and .345 (ignore exponential notation). 

b) Write a method ScanSupport.nextFloat() patterned after the existing nextName routine that returns a floating-point value if there is one or the special value Float.NaN if there isn't. 

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question