{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

UML Level of Detail (p. 92-3)

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

Info icon This 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() ); }
Image of page 1

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

View Full Document Right 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 )
Image of page 2
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern