Question
The purpose of this assignment is to exercise your familiarity with GUI programming and the Swing and awt libraries. The Program has to be done
The purpose of this assignment is to exercise your familiarity with GUI programming and the Swing and awt libraries.
The Program has to be done in Java.
For this assignment, youre required to turn in one program that involves 2D graphics in Java. You might want to use an IDE to write this. Graphics dont run on the command line easily. Please submit your file AtTheBeach.java through Canvas Problem Paint a 2D picture of beach using Java Swing application.
Specifications This program should be called AtTheBeach.java. For this program you are required to write 2 classes. The classes should be in the same file.
Please follow the given naming guidelines.
Define a class called BeachCanvas. Define a public method called paint.
This takes one argument of type Graphics and returns nothing. (5 points)
Set the color to a sandy brown. Suggested RGB value : 234 206 106.
Define a polygon with the vertices at (0, 450), (0, 630), (630, 630) and (630,450).
Draw this polygon. (10 points) Set the color to sea green.
Suggested RGB value : 32 178 170.
Define a polygon with the vertices at (0, 300), (0, 450), (630, 450) and (630,300).
Draw this polygon. (10 points)
Set the color to sky blue. Suggested RGB value : 0 191 255.
Define a polygon with the vertices at (0, 0), (0, 300), (630, 300) and (630, 0).
Draw this polygon. (10 points)
Set the color to yellow. Suggested RGB value : 255 255 0.
Draw a circle that is confined to the rectangle beginning at (100,100) with a radius of 80. (10 points)
Set the color to red. Suggested RGB value : 255 0 0.
Draw a filed arc section confined within the rectangle beginning at (400,400) which is 200 long and 125 high, from the angle 330 to the angle 190. (10 points)
Set the color to a very light gray. Suggested RGB value : 252 252 252.
Define a polygon with the vertices at (540, 405), (449, 452) and (560, 485).
Draw this polygon. (10 points)
Set the color to a dark brown. Suggested RGB value : 140, 45, 13.
Define a polygon with the vertices at (497,466), (450,570), (460, 580) and (510, 470).
Draw this polygon. (10 points)
Define a class called AtTheBeach.
Create a JFrame and set the bounds to 30 30 630 630. (5 points)
Add an object of BeachCanvas to the frame and set to to be visible. (10 points)
Describe which part of the scene youre drawing with each geometric figure. Please include comments wherever appropriate. (10 points) Extra Credit - 50 points You get 50 points extra credit for drawing a sailboat in the water. You just need to add three extra polygons in your paint method.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started