Question: ONLY IN JAVA Display random shapes Objectives: JAVA Graphics Create the necessary JAVA files/functions to solve the problem below. Feel free to explore the JAVA

ONLY IN JAVA Display random shapes

Objectives:

JAVA Graphics

Create the necessary JAVA files/functions to solve the problem below. Feel free to explore the JAVA syntax online, we suggest you use java official documentation.

Homework Instructions

We will implement a Java program that randomly chooses a shape from the list below, generate a random color, and define a random size to draw it on random location of the screen.

Here are the shapes that you should randomly choose from;

Square (each side is n pixel)

Circle (radius is n pixel)

Rectangle (width= 2*n pixel, height=n pixel)

Equilateral Triangle (each side is n pixel)

Regular Pentagon (each side is n pixel)

For each run;

your code should choose a random shape from the list above [25 points]

generate a random integer value for n value (for each n 25

generate a random color; use RGB color system (Hints: generate three random int between 0 and 255 ) [25 points]

Generate a random location to start drawing your shape (random x and y coordinate values, make sure you limit them to fit on the screen) [25 points]

Example runs;

Rectangle (80x40), color(200,125,58), location(x=35,y=-10) Circle (r=12), color (0,32,55), location (-15,36)

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!