Class - type of triangle
Write a class named Triangle
that includes fields for the integer coordinates of the triangle's vertices: x1, y1, x2, y2, x3, y3.
Implement the following constructors:
A default constructor that initializes the coordinates of the triangle's vertices to zero.
A parameterized constructor that accepts integer coordinates for the triangle's vertices and initializes them accordingly.
Implement methods to determine the type of the triangle:
void Out(): Outputs the coordinates of the triangle, separated by spaces, and ends with a new line.
bool equilateral(): Returns true if the triangle is equilateral; otherwise, returns false.
bool versatile(): Returns true if the triangle is scalene; otherwise, returns false.
bool isosceles(): Returns true if the triangle is isosceles; otherwise, returns false.
bool rectangular(): Returns true if the triangle is right-angled; otherwise, returns false.
bool acute_angled(): Returns true if the triangle is acute-angled; otherwise, returns false.
bool obtuse(): Returns true if the triangle is obtuse-angled; otherwise, returns false.
For verification, you should submit only the class.
Implemented verification in C++ and Java.
Testing
Test 1: Verify the parameterized constructor and the equilateral()
method.
Tests 4, 5: Verify the parameterized constructor and the versatile()
method.
Tests 2, 3: Verify the parameterized constructor and the isosceles()
method.
Tests 6, 7, 8: Verify the parameterized constructor and the rectangular()
method.
Test 9: Verify the parameterized constructor and the versatile()
method.
Tests 10-13: Verify the parameterized constructor and the acute_angled()
method.
Tests 14-15: Verify the parameterized constructor and the obtuse()
method.
Tests 16-18: Verify the parameterized constructor and all methods.