Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The quilt will be composed of two separate tile. The last method will use loops to draw an entire quilt in a checkerboard formation: public
The quilt will be composed of two separate tile. The last method will use loops to draw an entire quilt in a checkerboard formation:
public static void drawQuiltGraphics int int int tilesize,
int rows, int columns
is the Graphics object that will draw shapes on your behalf
and represent the upper left corner of the entire quilt
tileSize represents the widthheight of a single tile of the quilt
rows and columns represent the number of rows and columns of tiles in the quilt
The method should use a nested loop and alternate between your drawTileA and drawTileB methods to
achieve a checkerboard. The tester expects that your inner loop draws a row and the outer loop repeats the
inner loop to draw multiple rows.
The tester will try drawing multiple copies of your quilt at different locations in the drawing window with
different tileSize values and different rows and columns.
Java's Graphics library does not contain a fillTriangle method. For convenience, I have included one for you in
the starter code for the assignment:
public static void filltriangleGraphics Color int int
int int int int
int ;
int ys ;
gsetColor c;
gfillpolygonxs ys;
Since this is a custom method defined by me it is called a little differently than the builtin graphics methods.
The builtin methods are called using the syntax gmethodName;
Example: gfilloval size y size size size ;
The fillTriangle method is called using the syntax fillTriangleg size, size, size
designs arranged in a checkerboard formation. Below is an example quilt:
Start with the ColorfulQuilt class from Canvas. You will be writing three methods that together will create
a quilt formation such as the one displayed above. The first method will draw a single copy of your first tile
design:
public static void drawTileAGraphics int int int size
is the Graphics object that will draw shapes on your behalf.
and represent the upper left corner of the tile. All coordinate calculations should use as a
starting point as shown in class so that tiles can be drawn at any location in the drawing window.
size represents the widthheight of the square tile.
The CYANBLACKDARKGRAY tile above is an example tile drawn by this method. The tile should be square
and meet the following minimum requirements:
At least colors
At least triangles
At least circle
At least rectangle
The second method will draw a single copy of your second tile design:
public static void drawTileBGraphics int int int size
The GRAYREDBLACK tile above is an example tile drawn by this method. The tile should be square and has
the same minimum requirements as the drawTileA method at least colors, triangles, circle,
rectangle However, Tile has the following additional requirements:
The number of shapes should be different from Tile A For example, my Tile A design above has
shapes black border rectangle, cyan triangles, dark gray circle and my Tile B design above has
shapes dark gray background rectangle, red circles, light gray triangles
The number or shade of the colors should differ. For example, Tile A above has colors CYAN
DARKGRAY, BLACK and Tile B has colors LIGHTGRAY, DARKGRAY, RED This follows the rule
since the two tiles differ in their color shades. It is also okay if colors are reused but one tile has more
colors than the other.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started