Name: __________________________ NetID: _____________ Name: __________________________ NetID: _____________ Name: __________________________ NetID: _____________
This classwork focuses on implementing computing the mode of a list of numbers. The mode is the most commonly occuring value(s) in a data set.
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:
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. You should be able
to ignore everything other than numbers by using Scanner's hasNextInt()
method.
Test your code using: