Advertisement
Guest User

Subal (Square.java)

a guest
Mar 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 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 Square {
  12.     private double length;
  13.     public double area(double length) {
  14.         return (length * length);
  15.     }
  16.    
  17.     public double perimeter (double length) {
  18.         return (4 * length);
  19.     }
  20.     public void area() {
  21.         System.out.println("Area of the Square: " + (length * length));
  22.     }
  23.    
  24.     public void perimeter () {
  25.         System.out.println("Perimeter of the Square: " + (4 * length));
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement