Skip to content

Instantly share code, notes, and snippets.

@egealpay
Created February 27, 2019 10:20
Show Gist options
  • Save egealpay/e1be33bc0e98a8e5ea7341700fa95f2b to your computer and use it in GitHub Desktop.
Save egealpay/e1be33bc0e98a8e5ea7341700fa95f2b to your computer and use it in GitHub Desktop.
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