Question: In java, write code that creates drawing patterns in random sizes, colors, and locations. The basic patterns are: checkerboard, nested squares, and a spoked star

In java, write code that creates drawingpatterns in random sizes, colors, and locations.The basic patterns are: checkerboard, nested squares, and aspokedstar, and a spiral.Each pattern should be implemented as its own class. Complete the constructors, accessors, mutators, tostringanddrawmethods.
1. Complete and test the constructor,toStringand accessor and mutator methods for each class. Include javadoc comments with@paramand@returntags as described in your text.
2. Implement thedrawmethod for theStarclass that will draw a (spoked) star when it is called. The method should only be passed theGraphicsobject as a parameter. The location of the star, the number of spokes, the width of the star, and its color should all be obtained from theStarobjects instance fields. Instantiate aDrawingCanvasand severalStarobjects in yourmainmethod and call thedrawmethod for eachStarto make sure yourdrawmethod is working correctly. Add javadoc comments to the draw method.
3.Write thedrawmethod for theNestedSquaresclass with javadoc comments. CreateNestedSquaresobjects inmainand test thedrawmethod.
4. Write thedrawmethod for theCheckerboardclass with javadoc comments. CreateCheckerboardobjects and test thedrawmethod.
5. Once you have tested all three methods and know they work correctly, write loops to instantiate and draw several of each type of object with random locations, sizes, colors, etc. Use the JavaRandomclass. Make sure that no parts of any of your patterns are drawn outside of the window.
6. Implementa different pattern class (a spiral is an interesting one) and add random versions of your new pattern to your "painting."

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!