Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Java code how can these steps be done Base code: package ; import Media.*; // for Turtle and TurtleDisplayer import static java.lang.Math.*; // for

Using Java code how can these steps be done

Base code:

package ;

import Media.*; // for Turtle and TurtleDisplayer

import static java.lang.Math.*; // for Math constants and functions

import static java.awt.Color.*; // for Color constants

/** This class ...

*

* @author

*

* @version 1.0 () */

public class {

// instance variables

/** This constructor ... */

public ( ) {

// statements

}; // constructor

public static void main ( String[] args ) { s = new (); };

} //

image text in transcribedimage text in transcribed

Turtle Displayer Eile Help Turtle Canvas: Angle: -6.28... Location: (110, 110) Pen is: Pen Colour Pen Width: 1 Close To achieve this, your Wallpaper program requires a drawwallpaper () method. That drawwallpaper must relocate the turtle to equidistant points, and draw 4x4 flowers. A flower, then, may be drawn via a drawFlower () method, such that: The flower is a random colour The flower is comprised of multiple petals It has a random number of petals, from 4 to 7 (inclusive) Each petal is drawn as above: equiangular radiating from a single point at equal angles to each other Drawing a petal thus requires its own method, drawPetalo, to draw four lines like so: ........... 16 radians 30 If you need a reminder on calculating the length of the hypotenuse for an isosceles right triangle, it's just the square root of double the square of the other side length (in this case, -21.2, but still calculate it). Tips and requirements Even though it's described in pieces above, those are just pieces within the same source file. (i.e. you don't need to submit multiple .java files) For the flower, remember that you're still turning around one full turn overall For the petal, it's imperative to have the turtle end in the same position/angle as it started In case random colours haven't been covered in lab, you only need two things: o import java.awt.Color; (to get the library) open.setPenColor (new Color( (int) (Math.random() *16777216))); Though there are a couple places you could set the colour, there's only one correct spot Even though the petal is four lines, I'd advise against trying to put them into a loop; it's more trouble than it's worth Don't use parameters/arguments for your methods (Depending on when you read this, you may or may not even know what that means) The entire point of this assignment is hierarchical decomposition (breaking down the problem into smaller pieces), so if you skip that step, don't be surprised if you get a zero Your final solution will probably be -60 lines of code. It isn't a challenging assignment, per se, but rather one that reinforces what you learned in lecture/lab/tutorial. It covers a fundamental technique in computer science. Give it the consideration and attention your entire academic future deserves Because you're using procedural abstraction, you might want to consider writing stubs to get the basic components together e.g. you might initially draw a 'petal' as simply a line (that then reverses to return to where it started), for the sake of drawing the flower. You might even use a placeholder of a dot (e.g. forward (1)) for the flower, when figuring out positioning in the wallpaper as a whole Turtle Displayer Eile Help Turtle Canvas: Angle: -6.28... Location: (110, 110) Pen is: Pen Colour Pen Width: 1 Close To achieve this, your Wallpaper program requires a drawwallpaper () method. That drawwallpaper must relocate the turtle to equidistant points, and draw 4x4 flowers. A flower, then, may be drawn via a drawFlower () method, such that: The flower is a random colour The flower is comprised of multiple petals It has a random number of petals, from 4 to 7 (inclusive) Each petal is drawn as above: equiangular radiating from a single point at equal angles to each other Drawing a petal thus requires its own method, drawPetalo, to draw four lines like so: ........... 16 radians 30 If you need a reminder on calculating the length of the hypotenuse for an isosceles right triangle, it's just the square root of double the square of the other side length (in this case, -21.2, but still calculate it). Tips and requirements Even though it's described in pieces above, those are just pieces within the same source file. (i.e. you don't need to submit multiple .java files) For the flower, remember that you're still turning around one full turn overall For the petal, it's imperative to have the turtle end in the same position/angle as it started In case random colours haven't been covered in lab, you only need two things: o import java.awt.Color; (to get the library) open.setPenColor (new Color( (int) (Math.random() *16777216))); Though there are a couple places you could set the colour, there's only one correct spot Even though the petal is four lines, I'd advise against trying to put them into a loop; it's more trouble than it's worth Don't use parameters/arguments for your methods (Depending on when you read this, you may or may not even know what that means) The entire point of this assignment is hierarchical decomposition (breaking down the problem into smaller pieces), so if you skip that step, don't be surprised if you get a zero Your final solution will probably be -60 lines of code. It isn't a challenging assignment, per se, but rather one that reinforces what you learned in lecture/lab/tutorial. It covers a fundamental technique in computer science. Give it the consideration and attention your entire academic future deserves Because you're using procedural abstraction, you might want to consider writing stubs to get the basic components together e.g. you might initially draw a 'petal' as simply a line (that then reverses to return to where it started), for the sake of drawing the flower. You might even use a placeholder of a dot (e.g. forward (1)) for the flower, when figuring out positioning in the wallpaper as a whole

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions