Assignment 7, due Mar 10
Part of
the homework for CS:2820, Spring 2017
|
On every assignment, write your name and section number. Write your name as it appears on your university ID card! Use the section number as it appears in your current registration! We will not do detective work to figure out who did what. Homework is due on paper at the start of your discussion section. Exceptions will be made only by advance arrangement with your TA (excepting "acts of God"). Never push homework under someone's door!
road A B 1.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). (0.5 points)
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. (0.5 points)
a) Describe how to use Java's class hierarchy to permit the above change. (Do not write code to answer this, write a description of hierarchic class relationships.) (0.5 points)
b) How would the the header for Intersection.newIntersection() have to be changed to allow use of this new form. (0.5 points)
A problem: Construct a small example that demonstrates this. It can be done in 10 lines of totally useless code. (1.0 points)