Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of interface GeometricShape here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public interface GeometricShape
- {
- double area();
- }
- /**
- * Models a parallelagram in 2-d space
- */
- public class Parallelogram
- {
- private int width;
- private int height;
- /**
- * Constructor for objects of class Parallelogram
- * @param width the width of this parallelagram
- * @param height the height of this parallelogram
- */
- public Parallelogram(int width, int height)
- {
- this.width = width;
- this.height = height;
- }
- /**
- * Gets the width of this Parallelogram
- * @return the width of the parallelogram
- */
- public int getWidth()
- {
- return width;
- }
- /**
- * Sets the width of the Parallelogram
- * @param newWidth the value of the new width
- */
- public void setWidth(int newWidth)
- {
- width = newWidth;
- }
- /**
- * Gets the height of this Parallelogram
- * @return the height of the parallelogram
- */
- public int getHeight()
- {
- return height;
- }
- /**
- * Sets the height of the Parallelogram
- * @param newHeight the value of the new height
- */
- public void setHeight(int newHeight)
- {
- height = newHeight;
- }
- /**
- * Gets the area of a RightTriangle
- * @return the area of a RightTriangle
- */
- public double area()
- {
- double area = width * height;
- return area;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement