ASSIGNMENT 3
COSC1047: INTRODUCTION TO COMPUTER SCIENCE 2
MAYURKUMAR MANIYA
249484080
, EXERCISE: 1
METHODOLOGY:
• Create a GeometricObject class with attributes for color and filled state.
• Define a constructor in GeometricObject to initialize its attributes.
• Create a Triangle class that extends GeometricObject and adds three sides.
• Implement constructors in Triangle to initialize the side lengths, color, and filled status.
• Implement the getArea() method using Heron’s Formula for area calculation.
• Implement the getPerimeter() method to sum up the sides of the triangle.
• Override the toString() method in Triangle to display triangle properties.
• Develop a TriangleTest class to take user input and create a Triangle object.
• Print the triangle details, including its color, fill state, area, and perimeter.
• Run the program in Eclipse to verify correctness and validate user input.
UML DIAGRAM:
COSC1047: INTRODUCTION TO COMPUTER SCIENCE 2
MAYURKUMAR MANIYA
249484080
, EXERCISE: 1
METHODOLOGY:
• Create a GeometricObject class with attributes for color and filled state.
• Define a constructor in GeometricObject to initialize its attributes.
• Create a Triangle class that extends GeometricObject and adds three sides.
• Implement constructors in Triangle to initialize the side lengths, color, and filled status.
• Implement the getArea() method using Heron’s Formula for area calculation.
• Implement the getPerimeter() method to sum up the sides of the triangle.
• Override the toString() method in Triangle to display triangle properties.
• Develop a TriangleTest class to take user input and create a Triangle object.
• Print the triangle details, including its color, fill state, area, and perimeter.
• Run the program in Eclipse to verify correctness and validate user input.
UML DIAGRAM: