Sample Java Program for Geometric Object

Download Solution: Click to Download Solution
Solution File Name: GeometricObject.docx
Unzip Password: prestobear.com

Problem:
Sample Java Program for Geometric Object


1. GeometricObject.java

/*
 * This is the GeometricObject
 * This is the base class for the Triangle Class
 * This class provide basic methods for the Triangle class 
 */

public class GeometricObject {

}

2. TestTriangle.java
import java.util.Scanner;

/*
 * This class is the clas to Test for the Triangle class
 */

public class TestTriangle  {

}

3. Triangle.java
/*
 * This Class is to take the Triangle parameter and compute
 * Design a class named Triangle that extends
 * GeometricObject. The class contains:
 * Three double data fields named side1, side2, and side3 with default
 * values 1.0 to denote three sides of the triangle.
 * A no-arg constructor that creates a default triangle.
 * A constructor that creates a triangle with the specified side1, side2, and
 * side3.
 * 
 * The accessor methods for all three data fields.
 * A method named getArea() that returns the area of this triangle.
 * A method named getPerimeter() that returns the perimeter of this triangle.
 * A method named toString() that returns a string description for the triangle.
 */

public class Triangle extends GeometricObject {

}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.