View the step-by-step solution to:

can not get the the input correctly A private int data field named numSides that defines the number of sides of the polygon. The default value should...

can not get the the input correctly


A private int data field named numSides that defines the number of sides of the polygon. The default value should be 4.

A private double data field named sideLength that defines the length of each side. The default value should be 5.0.

A private double data field named xCoord that defines the x-coordinate of the center of the polygon. The default value should be 0.0.

A private double data field named yCoord that defines the y-coordinate of the center of the polygon. The default value should be 0.0.

A private double data field named apothem that defines the apothem of the polygon. The default value should 5.0.

A private double data filed named perimeter that defines the perimeter of the polygon. The default value should 20.0.

A no argument constructor that creates a Polygon using the default number of sides, default side length, default x- and y-coordinates, and the default apothem.

A constructor that creates a Polygon using a specified number of sides, side length, x- and y-coordinates and the apothem

Getter and setter methods for all data fields

A getArea() method that returns a double value representing the area of the polygon. (Note the area of a regular Polgon can be calculated from ½ * Apothem*Perimeter)

A toString() method that displays the number of sides, side length, x-coordinate, ycoordinate and apothem values in String format 

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question