TopcoderArchiveVisit Topcoder
Archive
Algorithm problem

Coins

Problem statement, definition, constraints, and public examples.

Problem Statement

Create a class called Coins that includes a method called getChange(int), where
the argument is a positive, whole number of cents that needs to get converted
to quarters, nickels dimes, and pennies. The return value of getChange is a
java.util.ArrayList that consists of the following elements, in order. (1)
number of quarters (2) number of dimes (3) number of nickels, and (4) number of
pennies. All should be Integers. Here is the method signature:
ArrayList getChange(int cents);
In case you are not familiar with ArrayLists, they are used to hold Java
Objects (Integers, Doubles, Strings, etc.). The method add(Object) is used to
insert at the end of an ArrayList. For more information, see the Java API.

Definition

Class:
Coins
Method:
getChange
Parameters:
int
Returns:
ArrayList
Method signature:
ArrayList getChange(int param0)
(be sure your method is public)

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems