Rules of submission
This assignment must be submitted to the Moodle submission page for Homework 10 by 11:00 PM on Monday, 1 April.
Your submission must contain two classes
WritePoints in the
You should start with the
you turned in to Homework 8
or the one provided for Lab 11.
When you create your new
randomPoints method into it.
First, add a method
toString to your
You should get into the
habit of overriding the default
whenever you write an interesting class.
In this case,
toString should return the convention tuple representation
of a point, such as
Second, have the
main method of
WritePoints ask the “user” for (1) the name
of a file to create and (2) the number of random points to write
to that file.
Read the file name first and then the number of points.
Also, read an entire line for the file name to allow
the inclusion of white space within the file name.
(A practice that has, in my opinion,
become too common.)
Do some input validation. If the “user” provides a bad file name or bad number, but sure that your program handles the exceptions Java will generate in these cases.
I suggest you use the FileWriter and PrintWriter in your application. There are examples of doing this in the textbook or all over the internet. You can even try the official Java tutorial on character stream I/O. See the CopyLine.java example for inspiration.