Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA. Write a program Art.java that takes one integer command-line argument n to control the depth of the recursion and produces a recursive pattern of

JAVA.

Write a program Art.java that takes one integer command-line argument n to control the depth of the recursion and produces a recursive pattern of your own choosing. //any commands

It's up to you what to write, as long as it follows the rules below.

  • The pattern can be based on recursively drawing a pattern, on recursive subdivision, like the dragon curve or fractal Brownian motion, or on any combination of the two. But it must be recursive (sorry, no Mandelbrot fractals they're very cool, but they aren't recursive).
  • The recursive structures of your program must be different from Sierpinski, H-Tree, Cantor set, and Brownian just changing the triangle in Sierpinski to a square, for example, is not enough. If the number of recursive calls is different, or the order in which the calls are made is different, you should be fine.
  • Your program must take one command-line argument. If your recursive function takes multiple parameters, you can choose some of the values that have the best effect, and do something like the following:
    image text in transcribed
    Your recursive function should work reasonably well up to at least a command line value of 6 or 7, but it must work at least somewhat (even if extremely slowly) with any number n.
  • Your program must not be tail-recursive. Tail recursive functions make only a single recursive call at the very beginning or end of the function. These are cases that are very easy to rewrite as a loop with no recursion, which means they aren't conceptually very interesting. (There are plenty of cases where a tail-recursive function may be more elegant than a loop, but we want you to do something that really requires recursion.)
  • Your drawing must stay within the unit square (the area between 0 and 1 in both x- and y-coordinates). You drawing must not extend outside the window, even though you wouldn't see those parts when you test. If you use the PennDraw.setXscale() and PennDraw.setYscale()functions, your drawing must stay withing the bounds you pass to those functions (i.e. the same are the unit square occupies by default). You mayuse a background image that is larger than the window, but please do not make it much larger, to avoid messing up our grading scripts.
  • Your Art.java cannot have interactive features that depend upon keyboard or mouse input: you may not call PennDraw.hasNextKeyTyped(), PennDraw.nextKeyTyped(), PennDraw.mouseX(), PennDraw.mouseY(), or PennDraw.mousePressed().
  • do not call, PennDraw.setCanvasSize(), or PennDraw.save(). These functions will break our test scripts, and you will receive a large point deduction.
commandLineArgument1) x0.55; y 0.75; n-3; if else if (commandLineArgument = 2) { x = 0.55; y = 0.75; n = 5; } else if (commandLineArgument3) x-0.32; y-0.71; n 8;h 1 else if... commandLineArgument1) x0.55; y 0.75; n-3; if else if (commandLineArgument = 2) { x = 0.55; y = 0.75; n = 5; } else if (commandLineArgument3) x-0.32; y-0.71; n 8;h 1 else if

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

Step: 3

blur-text-image

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

=+What do you think about the CDFI Fund, establish in 1994?

Answered: 1 week ago