Question: Task: 3: [10 marks] Displaying Polygons Write a program to displays several n-sided polygons. Create a subclass of JPanel, named N_sidedPolygon, that displays a pentagon,

 Task: 3: [10 marks] Displaying Polygons Write a program to displays

Task: 3: [10 marks] Displaying Polygons Write a program to displays several n-sided polygons. Create a subclass of JPanel, named N_sidedPolygon, that displays a pentagon, hexagon, heptagon, and octagon, nonagon, and decagon. These objects are created from N sidedPolygon in a frame. The class contains a property named Num of Sides, which specifies the number of sides in the polygon (So, if n is 3, it paints a triangle, if n is 4, it paints a square, etc.) The polygon is centered at the center of the panel. The size of the polygon is related to the size of the panel as shown in the figure below. n X 0000 0

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 Programming Questions!