Question: using java only no classes or private allowed =) Write a function drawStairs, that is passed a point, (x, y) and a number n. For
using java only no classes or private allowed =) Write a function drawStairs, that is passed a point, (x, y) and a number n. For example, a function call would be drawStairs(x, y, n);. The function should drawn steps starting at the given point, going down and to the right, and ending at the bottom of the canvas. Each step should be roughly the same height and width - at most one pixel different in height or width. See the picture at right for an example of what the function draws. This function should use only a single loop. Hint: The height of one step is the height of the staircase, divided by the number of steps. However, if you draw all the steps at this size, you will have pixels left over. How many pixels are left? How can you distribute those so that there is at most one pixel difference in the height of the steps
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
