Today's classwork focuses on implementing computing the mode of a list of numbers.
You will work with your group, but each of you should also use a laptop and solve all the problems. You should discuss problems with your group and help each other debug.
Snarf the classwork/08_files project. The source directory is also linked here.
ClassScores
class includes a
method called getScanner
. This method opens up a file
chooser and returns a Scanner to the selected file. Write the necessary code in your main
method to construct a ClassScores
object and call the getScanner
method to bind the selected file to a Scanner
named in
.
readAndPrintFile
, to print each token from the file -
one per line.
For example, if given the following file excerpt of library holdings from the data directory of the natural prestidigitation assignment:
your program should print:(* Library holdings (# of books in each library), *) (* collected by Christian Ayotte. *) (* Labels not available. *) 12201 600778 14926 37863 ...
(* Library holdings (# of books in each library), *) (* collected by Christian Ayotte. *) (* Labels not available. *) 12201 600778 14926 37863 ...
ClassScores
class that you snarfed.
ClassScores
class has two
different findMode
methods. Why? How does Java
distinguish the two methods? Write your answer in your
README
.
findMode(int[])
method.
Test
using:
example
in the main
method
findMode(Scanner)
method. Test using: