Skip to content

Instantly share code, notes, and snippets.

@guyhughes
Created April 11, 2016 18:18
Show Gist options
  • Save guyhughes/c43d89cf6c5a6569a12e5aa3955b6712 to your computer and use it in GitHub Desktop.
Save guyhughes/c43d89cf6c5a6569a12e5aa3955b6712 to your computer and use it in GitHub Desktop.
/*
* Question 5
* All of these classes should be public and in their own file.
*/
class Shape {
protected double x,y;
public Shape(double x, double y){
this.x=x;
this.y=y;
}
}
class Ellipse extends Shape{
protected double radius, major, minor;
public Ellipse(double x, double y, double radius, double major, double minor){
super(x,y);
this.radius=radius;
this.major=major;
this.minor=minor;
}
}
class Circle extends Ellipse{
public Circle(double x, double y, double radius){
super(x,y,radius,2*radius,2*radius);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment