Do not change the parameters or return type of the drawLine method! You are welcome to define other methods in the Lines class if you wish, but the drawLine method's signature (the number and types of its parameters and its return type) must be preserved as you do your work.
Your task is to devise an algorithm for drawing a line from (x1,y1) to (x2,y2) using recursion. It may take you some time to think about how to do that, but once you see the recursive nature of drawing a line, you will probably need only a few lines of code to accomplish this task.
Please take note of the following guidelines, as you will not receive credit unless your solution follows the rules of this assignment:
This means you must draw your line one point at a time.
Do not compute or use the slope of the line in your approach. We will not count the extension if you do that. Instead, think recursively about how a line is constructed.
When you done with this extension, you must be cleared by the TA to receive credit.
- Commit all your work to your repository
- Fill in the form below with the relevant information
- Have a TA check your work
- The TA should check your work and then fill in his or her name
- Click OK while the TA watches
- If you request propagation, it does not happen immediately, but should be posted in the next day or so
The idea for this assignment comes from the article "Persian Recursion" by Anne M. Burns that appeared on pages 196-199 of Mathematics Magazine, volume 7, in 1997.In the extensions folder open the recursivepatterns package and the PersianRug class. Your task is to complete the method persianRug so that it draws a rug similar to the one shown below:

Computing the color of these two lines is what makes the rug look as it does. More detail is given below concerning how to pick a color.
The parameters for persianRug are documented in the source code provided to you for this extension.
Notes:
As you know, 0 is the smallest index, and the largest index is palette.length-1.
Recall that these colors are represented as integers, each being an index into the palette array. What kinds of functions on integers return the same result no matter the order of those integers?

![]() |
![]() |
![]() |
| Ben Greene | Dylan Jew and Ari Spilo | Alan Waldman |
![]() |
![]() |
![]() |
| Sam Chase | Meagan Provencher | Ben Zod |
When you done with this extension, you must be cleared by the TA to receive credit.
- Commit all your work to your repository
- Fill in the form below with the relevant information
- Have a TA check your work
- The TA should check your work and then fill in his or her name
- Click OK while the TA watches
- If you request propagation, it does not happen immediately, but should be posted in the next day or so

You can proceed by working on either class first. However, if you postpone TransparentColor, you will see solid colors in your flower until you have completed that class.
The transparentColor method, as provided to you, ignores the alpha parameter and returns the color provided as input.
You must change this behavior so that the color returned as the same red, green, and blue components as the provided color, but with the specified transparency.Java makes this easy, because there is a constructor for Color that does the job. This task is given to you primarily to acquaint you with the process of looking through JavaDoc documentation to find a class or method you need.
Follow the instructions provided in the TransparentColor source code.
Before moving on, test your code by running TransparentColor as a Java Application. You should see the colors solid at the upper right of the drawing window, and blended (more transparent) at the lower left.You must demo this to a TA when you seek credit for this extension.
If necessary, review the material in the text and slides that discusses how to pick a random integer. You would use that integer to index the palette array.

When you done with this extension, you must be cleared by the TA to receive credit.
- Commit all your work to your repository
- Fill in the form below with the relevant information
- Have a TA check your work
- The TA should check your work and then fill in his or her name
- Click OK while the TA watches
- If you request propagation, it does not happen immediately, but should be posted in the next day or so