Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design and create a graphical (GUI) application that allows the user to choose a

ID: 3803621 • Letter: D

Question

Design and create a graphical (GUI) application that allows the user to choose a different shape for displaying its area and perimeter. Three choices: Circle - enter the radius value Rectangle: enter the width and height values Square: enter each side value Requirements: Give the user at least three choices or more for the different shape they want to display its area and perimeter the area and perimeter values must be displayed with two decimal places. You must use the Circle, Rectangle, and Square classes you have created from Assignment 1 to call each getArea() and getPeriemter() method to display its area and perimeter as well as call getName() method to display the information about the shape with the value. Event handles for any GUI component Exception handling if the user enters the wrong data value the interface is similar to the following figure: (or design your own interface)

Explanation / Answer

import java.awt.Shape; import java.awt.geom.*; public class Main { public static void main(String[] args) { int x1 = 1, x2 = 2, w = 3, h = 4, x = 5, y = 6, y1 = 1, y2 = 2, start = 3; Shape line = new Line2D.Float(x1, y1, x2, y2); Shape arc = new Arc2D.Float(x, y, w, h, start, 1, 1); Shape oval = new Ellipse2D.Float(x, y, w, h); Shape rectangle = new Rectangle2D.Float(x, y, w, h); Shape roundRectangle = new RoundRectangle2D.Float (x, y, w, h, 1, 2); System.out.println("Different shapes are created:"); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote