# “I think I had a kitchen floor like that in the 70s” R...

## Transcribed Text

“I think I had a kitchen floor like that in the 70s” Refer to Sakai for due date/time The emphasis in this assignment is to use methods to build (compose) a complex pattern from constituent parts. In preparation for this assignment, create a folder called Assign_2 for the DrJava project for the assignment. The problem is described in four parts however, you only submit the final solution from Part D. The file MethodTemplate.txt in the assignment folder is a skeleton of a Java program using Turtle Graphics and methods and can be copied and pasted as a starting point for your program. Part A As part of a package called Assign_2, write a Java class called Cover. For the first part, the class will draw an isosceles triangle on the display as shown below. Write a method called drawTriangle to draw the actual triangle. The triangle has two sides of length 30 making the hypotenuse √1800. Drawing from the center of the canvas, the exterior angle between the sides at the right vertex and top vertex are 3π/4 and the exterior angle between the sides at the bottom vertex is π/2. To make the Part B easier, make sure leave the turtle back where it started (i.e. at center facing right). Part B As the second part of the assignment, modify the Cover class written in Part A so that it draws a patch (diamond-shape) as seen below. Write a method drawPatch that draws the patch using the method drawTriangle from Part A. The patch consists of 4 triangles, equally spaced, drawn from the center of the canvas. Again, to make the Part C easier, be sure to leave the turtle where it started. Part C As the third part of the assignment, modify the Cover class written in Part B so that it draws a row of patches as seen below: Write a method drawRow that draws the row using the method drawPatch from Part B. The row consists of 5 patches. To make the Part D easier, be sure to leave the turtle where it started. Part D As the final part of the assignment, modify the Cover class written in Part C so that it covers the canvas with rows of patches as seen below: Write a method drawCover that draws the covering using the method drawRow from Part C. The covering consists of 5 rows. Since the cover consists of a lot of lines, draw it using a FAST Turtle. Suggestions:  The separation into multiple methods is mandatory—for a good reason. Build up the program as outlined above rather than trying to get the final result. Procedural abstraction allows you to ignore the details of say how the row is drawn, when writing the code to draw the cover.  To make procedural abstraction effective, it is necessary to know where the turtle starts drawing and where it ends up after each method (e.g. after drawRow). Then all you have to do in drawCover is make sure you put the turtle where desired after each row.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

/**
*
* @author
*/
import Media.*;
import static java.lang.Math.*;

public class Cover {

private TurtleDisplayer display;
private Turtle yertle;

private double side;
private double hypotenuse;

/**
* default constructor of Turtle create a Canvas of size 300x300
*/
private static final double WIDTH = 300;
private static final double HEIGHT = 300;

public Cover() {
display = new TurtleDisplayer();
yertle = new Turtle();
// thr turtle is put at center of the canvas
display.placeTurtle(yertle);
yertle.setSpeed(Turtle.FAST);

/**
* The triangle has two sides of length 30 making the hypotenuse ?1800.
*/
this.side = 30;
this.hypotenuse = Math.sqrt(1800.0);

drawCover();

display.close();
}

/**
* draws the covering using the method drawRow from Part C. The covering
* consists of 5 rows. Since the cover consists of a lot of lines, draw it...

By purchasing this solution you'll be able to access the following files:
Solution2.docx and Solution1.zip.

# 50% discount

Hours
Minutes
Seconds
\$70.00 \$35.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.