Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Sphere extends PaintShape {
- final static double i = 3.14;
- double radius;
- public Sphere(String shapeName, int coverage) {
- super(shapeName, coverage);
- }
- public double area() {
- return 4 * Sphere.i * radius * radius;
- }
- public static void main(String[] args) {
- Sphere sp = new Sphere("sphere",350);
- sp.radius=15;
- System.out.println("computing amount for shape: sphere is " +sp.amount());
- //PaintShape ps=new PaintShape("name",24);
- }
- }
Add Comment
Please, Sign In to add comment