Commit c8182b71 authored by Suleman Hussain's avatar Suleman Hussain

finished

parent 853f88a2
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
public class App {
public static void main(String[] args) throws Exception {
Shape shape1 = new Rectangle(5,10);
Shape shape1 = new Rectangle(3,8);
shape1.draw();
}
}
No preview for this file type
......@@ -3,6 +3,7 @@ public class Rectangle extends Shape{
public int width;
public int height;
public int getWidth() {
return this.width;
}
......@@ -10,21 +11,30 @@ public class Rectangle extends Shape{
public void setWidth(int width){
this.width=width;
}
public int getHeight() {
return this.height;
}
public void setHeight(int height) {
this.height=height;
}
public Rectangle() {
super();
this.setHeight(4);
this.setWidth(3);
}
public Rectangle(int i,int j) {
super();
this.setHeight(height);
this.setWidth(width);
this.setHeight(j);
this.setWidth(i);
}
public Rectangle(int i) {
super();
this.setWidth(i);
}
@Override
......
No preview for this file type
abstract public class Shape {
protected int size;
protected int width;
protected int height;
abstract public void draw();
abstract public float area();
abstract public float circumference();
abstract public int getWidth();
abstract public int getHeight();
abstract public void setHeight(int height);
abstract public void setWidth(int width);
public int getSize() { return size; }
public void setSize(int size) { this.size = size; }
public Shape(){
this.size = 3;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment