Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.0 image text in transcribed 
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 perimeter0:I/ return perimeter (very simple math)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions