Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAM It can any figure just looks like the picture but many shapes inside the first shape. Any loop can be use to draw

JAVA PROGRAM

It can any figure just looks like the picture but many shapes inside the first shape.

Any loop can be use to draw the entire figure and use task decomposition then call the functions in the main.

1. Input

This program gathers no input from the user.

2. Output

3.1 Part 1

Generate this graphic output shown at right, on a 500x500 DrawingPanel.

Alter the colors (drawing and background) to suit your own taste.

For descriptions of the technique and samples of output, see these sites: site1, site2.

3.2 Part 2

Create an additional drawing panel at least 400 x 400. On it, draw filled-in shapes of at least two types (rectangles, circles, etc.) in at least two colors.

Each shape type should be drawn by its own function (that you write) with parameters indicating where it is to be drawn and how big it is to be. Consider including the color as a parameter as well; this would make the function more flexible.

Draw at least ten shapes in an attractive pattern; do something fun and interesting of your own design.

3. Instructions

Use the provided DrawingPanel.java class. Put this in the same folder as your solution.

Use procedural decomposition to break down the program into logical pieces.

Part 1: set constants for the drawing panel size and the line increment. Assume your figures may drawing on different sizes of the canvas.

Part 1: try various line increments until you find one that is visually pleasing and looks curved.

Use a Random object for creating different colors.

4. Code Implementation

Create a class called HW2Drawing; use this single class to do all your work. You should have only one main function that directs both parts of the project. Follow the provided Course Style Guide.

5.1 What You Should Use

Constants and variables

Definite loops (For Part 1, a single loop should be used to draw the entire figure)

Drawing panel and graphics objects

A single main program that draws both drawings (Part 1 and Part 2)

5.2 What You Shouldnt Use

Selection control structures, unless you are doing something way above and beyond the specification.

image text in transcribed

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

More Books

Students also viewed these Databases questions

Question

What is component depreciation, and when must it be used?

Answered: 1 week ago