CS计算机代考程序代写 Java b’146035c927eb2951e316b17d83e5bc643e0bec’

b’146035c927eb2951e316b17d83e5bc643e0bec’

blob 555�package programmingexample5;

import java.awt.Color;

public class Triangle extends Shape implements ShapeVisitable {

private int base, height;

public Triangle(int base, int height, Color c) {
super(c);
this.base = base;
this.height = height;
}

@Override
public double area() {
return 0.5 * base * height;
}

@Override
public void accept(ShapeVisitor v) {

/*
* TODO You need to implement this method, to answer the question.
*/

v.visit(this);
}

}