numUnique
Category: Programming
Author: Stuart Reges
Book Chapter: 4.1
Problem: numUnique
Write a method called numUnique that takes three integers as parameters and that returns the number of unique integers among the three. For example, if the following call is made: numUnique(18, 3, 4) the method should return 3 because the parameters represent 3 different numbers (the values 18, 3 and 4). By contrast, the following call: numUnique(6, 6, 6) would return 1 because there is only 1 unique number among the three parameters (the value 6). The values passed to your method might appear in any order whatsoever, so you cannot assume that duplicate values would appear together. For example, if the following call is made: numUnique(7, 31, 7) the method should return 2 because there are 2 unique numbers among the parameters (the values 7 and 31).