Completed

Java Assignment for class

This project was successfully completed by abhinay18 for $40 USD in a day.

Get free quotes for a project like this
Employer working
Completed by:
Project Budget
$30 - $250 USD
Completed In
1 day
Total Bids
20
Project Description

The goal is to create a project that would let a user compute area and perimeter of a polygon. Restrict

the type of polygon inputs to Triangle, Quadrilateral, Pentagon, Hexagon, and Octagon only. Your

program must implement classes IsocelesTriangle, EquilateralTriangle, Rectangle, and Square, which

have the appropriate inheritance relationships. Use abstract classes, interfaces, and exception handling

where appropriate.

For pentagon, hexagon, and octagon assume that the polygon is regular i.e. all the sides are of same

length. For these the input must consist of the type of polygon and length of side (example: pentagon

and 7 where type is pentagon and 7 is length of each side of a pentagon). Use the following formulae’s

to compute the area of a regular polygon where “a” is the length of the side.

Area of regular Octagon:

Area of a regular Hexagon: √

Area of a regular Pentagon:

In case of a triangle or quadrilateral you may or may not have a regular polygon. If a triangle or

quadrilateral is regular then it’s an equilateral triangle or a square respectively. In these cases again your

input will consist of the type of polygon and length of side (example: quadrilateral and 4). If a triangle

or quadrilateral is not regular then the only allowed types must be an rectangle and isosceles triangle. In

each of these cases your inputs will consist of three parts. The first part will be type of polygon and

second and third parts will be the two different possible side. In case of a rectangle let your second input

be length (l) and third input be width (w) and in case of a isosceles triangle let the second input be

base(b) and the third input be height (h). Use the following formulae’s for triangles and quadrilaterals.

Area of an equilateral triangle: √

Area of a square:

Area of an isosceles triangle:

Area of a rectangle:

Sample inputs:

1. pentagon 5

2. octagon 4

3. triangle 3

4. triangle 4 8

5. quadrilateral 8

6. quadrilateral 6 3

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online