Advertisement
Guest User

Subal (Triangle.java)

a guest
Mar 21st, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package shape;
  6.  
  7. /**
  8.  *
  9.  * @author user
  10.  */
  11. public class Triangle {
  12.     private double base;
  13.     private double height;
  14.     public double area(double base, double height) {
  15.         return (1/2 * base * height);
  16.     }
  17.     public void area() {
  18.         System.out.println("Area of the Triangle: " + (1/2 * base * height));
  19.                
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement