Question
Submit Hexagon.java to model the concept of a hexagon, that meets the following specifications: (there should be no need for static anything in the Class)
Submit Hexagon.java to model the concept of a hexagon, that meets the following specifications:
(there should be no need for static anything in the Class)
1. Two (and only two) private fields:
private Point center; // required to be center of the hexagon
private double side; // the length of one side (all six are same)
2. With two constructors:
Default constructor (set all field data to zeroes)
public Hexagon(Point c, double s) // use Point from java awt
3. The usual accessors and mutators:
public Point getCenter();
public double getSide();
public void setCenter(Point c);
public void setSide(double r);
4. Create a couple more useful methods:
public double area(); // returns area (Google has formula)
public double perimeter(); // return perimeter (very simple math)
For example:
// Client tests the Class we've made Hexagon h1 = new Hexagon(new Point(82,92),10); h1.setSide(50); h1.area(); // returns 6495.19 h1.perimeter(); // returns 300.0Submit Hexagon.java to model the concept of a hexagon, that meets the following specifications: there should be no need for static anything in the Class) 1. Two (and only two) private fields: private Point center; required to be center of the hexagon private double side; /the length of one side (all six are same) 2. With two constructors: Default constructor (set all field data to zeroes) public Hexagon(Point c, double s)// use Point from java awt 3. The usual accessors and mutators: public Point getCenter); public double getSide; public void setCenter(Point c) public void setSide(double r); 4.Create a couple more useful methods: public double area:/ returns area (Google has formula) public double perimeter0:I/ return perimeter (very simple math)
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