In this section, you are going to work on a few problems that continue to give you practice using functions, as well as boolean expressions.
Write a function named drawCircle .
This function will have a total of two `int` parameters.
The function will draw a circle at this x/y position with a diameter of 70px.
If the x value is less-than or equal-to the y value, the circle shall be yellow.
Otherwise, it shall be blue.
You may only use one if-statement (and no else!)
For example, the below code will produce the canvas to the left once the function is created.
|
Write a function named checkPointsSame .
This function will have a total of four `int` parameters.
The first two will be the x/y coordinates of a point on the canvas, the the latter two will be the x/y coordinates of another point.
If the two coodinates are the exact same, you will draw a green square centered at that position.
If they differ, you will draw two red circles, at each location separately.
You may only use one if/else statement.
For example, the below code will produce the canvas to the left once the function is created.
|
write a function named mouseRect .
this function will have a total of four `int` parameters.
the parameters will be the same as the normal processing rect function.
the first two prameters will be the x and y coordinates, and the last two will be the width and height.
the rectangle shall be red.
however, this will be a "special" rectangles that has interactivity with the mouse.
when the mouse is on top of it, it turns green.
when the mouse clicks on it, it turns light-blue.
you may only use two if-statements. no "else" or "else-if".
For example, the below code will produce the canvas to the left once the function is created.
|
Write a function named twoRects .
This function will have a total of eight `int` parameters.
For reference, the function definition (not filled in with code) would look like so:
|