A set of stairs consists of risers (the vertical parts of the stairs) and
treads (the horizontal parts that you walk on). The stairs alternate
treads and risers, starting and ending with a riser as shown below.
A set of stairs with two treads would have three risers and would look
similar to this picture:
+........
|
+---+
|
+---+
|
........+
We have the following
requirements for a set of stairs: -
all risers must have the same integer height
-
all treads must have the same integer width
-
each riser must be less than or equal to maxHeight
-
each tread must be greater than or equal to minWidth
The totalWidth of the stairs is the sum of all the tread widths, while the
totalHeight of the stairs is the sum of all the riser heights. The stairs start
with a riser and end with a riser.
Create a class Stairs that contains a method designs that takes as input four
ints: maxHeight, minWidth, totalHeight, totalWidth. It returns the number
of different designs that meet the design criteria.
|