Course Hero Logo

Triangle.java - /= / Name: Long Nguyen / Student Number:...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 2 out of 2 pages.

//==============================================// Name:Long Nguyen// Student Number:155176183// Email:[email protected]// Section:NBB// Day:May 31th 2020// Workshop:2&3//==============================================package Shapes;import java.text.DecimalFormat;public class Triangle implements Shape {private double a;private double b;private double c;private double h;public Triangle(final double a, final double b, final double c) throwsException {if ((a > 0 && b > 0 && c > 0) && (a + b > c) && (a + c > b) && b + c > a) {this.a = a;this.b = b;this.c = c;} else {throw new Exception("Invalid side(s)!");}}public Triangle(final double a, final double b, final double c, final double h)throws Exception {if (a > 0 && b > 0 && c > 0 && h > 0) {this.a = a;this.b = b;this.c = c;this.h = h;} else {throw new Exception("The value cannot equal 0 or below 0!");
End of preview. Want to read all 2 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Winter
Professor
N/A
Tags
Subroutine, Return statement, Void type, public class triangle, Long Nguyen

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture