![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Use java
See the image for requirements
![Extension 4 - Draw n-gon
For the final pre-defined choice of extension, you must implement a method that draws a regular polygon w
parameterized number of sides and length for these sides. As the shape is regular, each side will have the s
length.
Examples of regular polygons are the equilateral triangle, square, pentagon, hexagon, etc...
This method must have the following header:
public static void drawNgon (Turtle t, int numSides, int side Length) {
The parameters are used as follows:
• Turtle t
o Used to draw the random shape
int numSides
o The number of sides to draw. If this value is 5, then a pentagon should be drawn for example.
int side Length
o The length of each side to draw
The angle that the Turtle should turn after each side can be found using the following formula:
double angle = 360.0 / numSides
Using this formula, the angle that the Turtle would need to turn each time to make a pentagon would be:
360.0/5 = 72.0](https://content.bartleby.com/qna-images/question/6c680976-d041-43f6-b2b7-59630778639d/b4981a90-ff84-4043-9229-ea4527bf8c6c/vo5jdp9_thumbnail.jpeg)
![Check Mark](/static/check-mark.png)
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
![Blurred answer](/static/blurred-answer.jpg)
Thanks you so much!
Another questions: this is my code (see image), and I was trying to let the turtle to draw 4 different sizes sqaures, but after I ran my code, the turtle drew out 4 same size squares, where or how should I fix it(or update it)?
thank you.
![53
54 }
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
t.down();
public static void drawRandomS (Turtle t, Random rand, int numSquares, int maxSize) { // Extension
int randomSize = rand.nextInt (maxSize - 0 + 1) + 0;
for (int square = 0; square < numSquares; square++) {
for (int k = 0; k < 4; k++) {
t. forward (randomSize);
t.left (90);
}
}
}
t.up();
t. forward (120);
t.down();
t.up();
t. forward (200);
t.down();
/home/Shapes.java 61:28 Spaces: 4 (Auto)
Console Terminal
X Exceeded wall time](https://content.bartleby.com/qna-images/question/6c680976-d041-43f6-b2b7-59630778639d/f4e253ce-b7cc-47cb-a6d6-c58edf323b68/k2jluu_thumbnail.jpeg)
Can you provide a screenshot? It's a little bit hard to read like this
thank you
Thank you. But can you use the parameters and the formula given in the image??
Thanks you so much!
Another questions: this is my code (see image), and I was trying to let the turtle to draw 4 different sizes sqaures, but after I ran my code, the turtle drew out 4 same size squares, where or how should I fix it(or update it)?
thank you.
![53
54 }
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
t.down();
public static void drawRandomS (Turtle t, Random rand, int numSquares, int maxSize) { // Extension
int randomSize = rand.nextInt (maxSize - 0 + 1) + 0;
for (int square = 0; square < numSquares; square++) {
for (int k = 0; k < 4; k++) {
t. forward (randomSize);
t.left (90);
}
}
}
t.up();
t. forward (120);
t.down();
t.up();
t. forward (200);
t.down();
/home/Shapes.java 61:28 Spaces: 4 (Auto)
Console Terminal
X Exceeded wall time](https://content.bartleby.com/qna-images/question/6c680976-d041-43f6-b2b7-59630778639d/f4e253ce-b7cc-47cb-a6d6-c58edf323b68/k2jluu_thumbnail.jpeg)
Can you provide a screenshot? It's a little bit hard to read like this
thank you
Thank you. But can you use the parameters and the formula given in the image??
- Provide directional explanations for the design flaws. Most pointers in programming languages can only refer to one particular sort of variable.arrow_forwardWhat exactly is meant by the phrase "user-defined data types"?arrow_forwardFor whatever reason, a data object is not included in the data model.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
![Text book image](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)