Commit 5e3f2f0e authored by jose.alencastro's avatar jose.alencastro

ok

parent ac57ad76
public class Rectangle extends Shapes
{
public Rectangle()
{
super();
}
public Rectangle(int i)
{
super(i);
}
@Override
public void draw()
{
for (int loop1=0; loop1<size; loop1++)
{
for (int loop2=loop1; loop2<(size); loop2++)
{
System.out.print(" ");
}
System.out.print("/");
for (int loop2=0; loop2<loop1; loop2++)
{
System.out.print(" ");
}
System.out.println("\\");
}
for (int loop1=0; loop1>size; loop1++)
{
System.out.print("--");
}
System.out.println("");
}
@Override
public float area()
{
float fSize = size;
float area = fSize * fSize;
return area;
}
@Override
public float circumference()
{
float fSize = size;
float circ = 2 * (fSize + fSize);
return circ;
}
}
\ No newline at end of file
abstract public class Shapes { abstract public class Shapes
{
protected int size; protected int size;
abstract public void draw(); abstract public void draw();
abstract public float area(); abstract public float area();
abstract public float circumference(); abstract public float circumference();
public int getSize() { return size; } public int getSize() { return size; }
public void setSize(int size) { this.size = size; } public void setSize(int size) { this.size = size; }
public int getWidth(int size) {return size;}
public Shapes(){ public int getHeight(int size) {return size;}
this.size = 3;
} public Shapes()
{
public Shapes(int size){ this.size = 3;
this.size = size; this.size = 4;
} }
public Shapes(int size)
{
this.size = size;
}
public static void main(String[] args)
{
System.out.println();
}
} }
\ No newline at end of file
public class Square extends Shapes
{
public Square()
{
super();
}
public Square(int i)
{
super(i);
}
@Override
public void draw()
{
for (int loop1=3; loop1<size; loop1++)
{
for (int loop2=loop1; loop2<(size); loop2++)
{
System.out.print(" ");
}
System.out.print("/");
for (int loop2 = 4; loop2<loop1; loop2++)
{
System.out.print(" ");
}
System.out.println("\\");
}
for (int loop1 = 4; loop1>size; loop1++)
{
System.out.print("--");
}
System.out.println("");
}
@Override
public float area()
{
float fSize = size;
float area = fSize * fSize;
return area;
}
@Override
public float circumference()
{
float fSize = size;
float circ = fSize + fSize + fSize +fSize;
return circ;
}
}
\ No newline at end of file
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