Question
(Using Java for this program) I need help getting user input(JOPTIONPANE) for the number of corners of a polygon, which is for the length of
(Using Java for this program) I need help getting user input(JOPTIONPANE) for the number of corners of a polygon, which is for the length of the array I have to use, and depending on what is entered from the input, ex: if 4 is entered then the Joptionpane will ask the user to enter an number for the x, and y coordinates 4 times,(total of 8 JOPTIONPANE windows), once all of that is entered, they will be stored in the array. Then using this data, i have to calculate the sides, perimeter, and area of the polygon.
The number of sides that will need to be calculated will also depend on the length of the array. I dont know how to approach this, and need help to find the area, perimeter, and sides. I am also struggling with the display window(JOPTIONPANE) EX.
Properties of Polygon are ________________________________ Point 1 = (Depends on input for coordinates) Point 2 = (Depends on input for coordinates) Point 3 = (Depends on input for coordinates) Point 4 = (Depends on input for coordinates) (Depending on the number of corners(size of array), that will determine how many sets of points (1 2 3...)) Side 1... (Depending on the number of corners(size of array), that will determine how many sides (1 2 3...)) Perimeter = Area =
How do I display this in the JOPTIONPANE message window?
BTW, I am using classes and methods, and have the main class on the main .java file. This is for the polygon class
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