You are on page 1of 1

Background:

For any perimeter of a rectangle, there may be multiple different dimensions that result in that specific
perimeter. When there are multiple dimensions for the same perimeter, there may also be multiple
areas. In other words, any one perimeter can result in different areas depending on the possible
combinations of dimensions that can make that perimeter.

Definition:

A dimension or instance of dimensions for a rectangle is a pair of length and width values. A dimension
with length 5 and width 4 is considered the same as a dimension with length 4 and width 5.

The area of a rectangle is the length multiplied by the width.

The perimeter of a rectangle is equal to the sum of the lengths of all 4 sides or the sum of 2 multiplied
by the width and 2 multiplied by the length.

Requirement:

A finite set of possible perimeters of a rectangle exist given a maximum perimeter, minimum length of
any side, and the constraint that all sides are whole numbers; we will call this set U. Find the subset of
perimeters in set U where all of the possible dimensions for a perimeter in the subset have areas
common with the areas of one or more other perimeters in set U.

Your program should take the minimum length of any side and the maximum perimeter, respectively, as
command line arguments and output a comma separated list of the perimeters that meet the criteria
explained above, sorted from lowest to highest.

The program should be submitted in a single Java class with an implemented main function that
provides the correct output given the two input arguments.

Example:

javac YourClass.java
java YourClass 1 64
10,14,18,20,22,26,30,34

Please make sure your program can be run with the exact syntax above. You can name the class
anything you like, but the class name will be passed to a program that will compile it and then run a set
of tests on the resulting program. It is important that your class will compile and run from within a local
directory, not a package directory.

You might also like