Implement an abstract class Shape with methods:

getType() returns a string denoting type of a shape (point, line, polygon ..)
area() returns area of the object, or -1 if the shape is concave, intersecting, or does not have an area
circumreference() returns circumreference of the object
position() returns center coordinates of the object
isConvex() returns true if shape is convex
distance(Shape s) returns distance to the center of another shape
Extend the Object classe into Point, Line, Triangle, and Polygon. Overload the inherited methods. Constructors of these classes take vertices coordinates as an input.
I need help to write this program .

The program should load a shape from a file and output its surface area. The input file contains a series of real numbers indicating coordinates of vertices. Example:

1 2 3 4 5 6.43 // Denotes a triange with vertices at (1, 2) (3, 4) (5, 6.43)
There should not be a limitation of how many points the program can load.

Example:

Input: 1 1 1 2 2 2 Output: 0.5
Input: 1 3.4 3 3 13.13 3 Output: 2.026
Input: 1 1 1 2 2 2 3 1 2 0 Output: 2.5
Input: 0 -10 Output: -1

Reverend Jim commented: Lazy. +0

Looks like homework to me. So far the only effort you have shown is copy/paste. Please read the Daniweb Posting Rules and Suggestions For Posting Questions.

commented: yes it is , but I dont want you to write a code because I know its i along code and a lot of work . I want if someone can tell me how yo start +0

What language would be a great start.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.