Question: Program in Java menu main The code for displaying a menu and allowing the user to pick an option is already written in the menu()

Program in Java

menu main

The code for displaying a menu and allowing the user to pick an option is already written in the menu() method. In main, you need to call it and then based on the String that is returned called the appropriate drawing method. The calls to the various methods below are up to you. main is there to demonstrate that your code works. You can certainly hard code in a particular call, or you may do like I did in the demo and have some randomization, using the given rand method.

Drawing Your Name

In the method drawName, make the turtle draw out your first name. If your first name has more than 5 letters, you may use an nickname.

Drawing A Regular Polygon

Write the code to have the turtle draw a regular polygon with the specified number of sides and specified side length.

Drawing Multiple Polygons

In the manyPolygons methods, write the code to have the turtle draws the specified number of regular polygons, each starting at the same place, however, after each polygon is drawn the turtle turns 360.0 / numPolys degrees.

Some calls to manyPolygons to try out:

manyPolygons(t, 45, 3, 100)

manyPolygons(t, 60, 30, 20)

Drawing Radiating Lines

The first image was generated calling the radial method and specifying 15 line segments and a line length of 100.

Program in Java menu & main The code for

In this next image 720 line segments were specified again with line length 100.

Program in Java menu & main The code for

If n lines are drawn, then the angle between them is 360.0 / n. Furthermore the color of the line depends on the angle the turtle is facing when drawing that line. A line drawn at angle ang has the HSB/HSV color of (ang / 360, 1, 1). You may want to refer to https://docs.oracle.com/javase/8/docs/api/java/awt/Color.html#getHSBColor-float-float-float-

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 Databases Questions!