Compsci 100e, Spring 2011, Classwork 5

Names and NetID of students in group (min 2, max 3)
Name: __________________________   NetID: _____________

Name: __________________________   NetID: _____________

Name: __________________________   NetID: _____________

Calculating the Mode AGAIN - this time using a Map

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. We will use the same ClassScores as before, but this time use a map.

The ClassScores class is what we started with last time. This time we will just focus on solving the method findMode(int[]) method using a map this time.

Remember the mode of a list of numbers is the most commonly occuring number(s). For example, if you have the following numbers, [88, 70, 65, 70, 88], the modes are 70 and 88 because they occur twice, while 65 ocurs once.

Complete the method below. Turn this classwork in during class.

public class ClassScores { public int[] findMode(int[] scores) { // TODO: complete findMode for an array