UML Level of Detail (p. 92-3)

UML Level of Detail (p. 92-3) - { super( org ); radius =...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
public abstract class Shape { private Color color; private Point origin; protected Shape( Color col, Point org ) { origin = new Point( org.getX(), org.getY() ); color = new Color( col.getR(), col.getG(), col.getB() ); } protected Shape( Point org ) { origin = new Point( org.getX(), org.getY() ); color = new Color( col.getR(), col.getG(), col.getB() ); } protected Shape() { origin = new Point( 0.0, 0.0 ); color = new Color( 0, 0.0 ); } public abstract double area(); public abstract double perimeter(); public Color getColor() { return color; } public void setColor( Color col ) { color.setRGB( col.getR(), col.getG(), col.getB() ); } public Point getOrigin() { return origin; } public void setOrigin( Point org ) { origin.setPoint( org.getX(), org.getY() ); }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
} public abstract class Circle extends Shape { private double radius; public Circle() { super(); radius = 0.0; } public Circle( final Point org, final double rad )
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { super( org ); radius = 0.0; } @Override public double area() { return Math.PI * radius * radius; } public double getRadius() { return radius; } @Override public double perimeter() { return 2 * Math.PI * radius; } public void setRadius( double r ) { radius = r; } } public abstract class Rectangle2 extends Shape { private double height; private double width; public Rectangle2() { super(); height = 0.0; width = 0.0; } public Rectangle2( Point org, double h, double w ) { super( org ); height = h; width = w; } @Override public double area() { return height * width; } @Override public double perimeter() { return 2 * ( height + width ); } public double getH() { return height; } public double getW() { return width; } public void setHW( double h, double w ) { height = h; width = w; } }...
View Full Document

This note was uploaded on 02/15/2011 for the course CS 119 taught by Professor Jackson during the Fall '10 term at Jackson State.

Page1 / 3

UML Level of Detail (p. 92-3) - { super( org ); radius =...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online