Commit 00f55578 authored by gavin.white's avatar gavin.white

Upload New File

parent 610d1f81
public class Triangle extends Shape{
// An equilateral triangle
public Triangle() {
super();
}
public Triangle(int i) {
super(i);
}
@Override
public void draw() {
for (int loop1=0; loop1<size; loop1++){
for (int loop2=loop1; loop2<(size-1); 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 = 0.5f * fSize * fSize;
return area;
}
@Override
public float circumference() {
float fSize = size;
float circ = fSize + fSize +fSize;
return circ;
}
}
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