Created
February 27, 2019 10:20
-
-
Save egealpay/e1be33bc0e98a8e5ea7341700fa95f2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Square implements Shape { | |
private Point topLeft; | |
private double side; | |
public double area() { | |
return side*side; | |
} | |
} | |
public class Rectangle implements Shape { | |
private Point topLeft; | |
private double height; | |
private double width; | |
public double area() { | |
return height * width; | |
} | |
} | |
public class Circle implements Shape { | |
private Point center; | |
private double radius; | |
public final double PI = 3.141592653589793; | |
public double area() { | |
return PI * radius * radius; | |
} | |
} | |
interface Shape { | |
double area(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment