1
Student Name: __________________
Class and Section __________________
Total Points (20 pts) __________________
Due: September 12, 2016 before the class
Project: The Triangle Class
CSCI 1302 Advanced Programming Principles
Armstrong Atlantic State University
Problem Description:
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 noarg constructor that creates a default triangle.
A method named getPerimeter() that returns the
perimeter of this triangle.
A method named toString() that returns a string
description for the triangle.
For the formula to compute the area of a triangle, see
Exercise 5.19. The toString() method is implemented
as follows:
Design:
Draw the UML class diagram here
2
Coding: (Copy and Paste Source Code here. Format your code using Courier 10pts)
public class Exercise11_01 {
public static void main(String[] args) {
class Triangle extends GeometricObject {
// Implement it
}
Submit the following items:
1. Print this Word file and Submit to me before the class on the due day.
2. Compile, Run, and Submit to LiveLab (you must submit the program regardless
whether it complete or incomplete, correct or incorrect)
3
Solution Code:
public class Test {
public static void main(String[] args) {
}
/** Override method findArea in GeometricObject */
public double getArea() {