Difference between revisions of "Shape"
(→area()) |
|||
Line 1: | Line 1: | ||
=Motivation= | =Motivation= | ||
− | Experience | + | Experience implementing interfaces. |
=Mistakes To Avoid= | =Mistakes To Avoid= |
Revision as of 07:11, 21 January 2020
Contents
Motivation
Experience implementing interfaces.
Mistakes To Avoid
Warning: Do NOT Parallelize |
Code to Investigate
Shape
package shape.core; public interface Shape { double area(); }
Code to Implement
Rectangle
public class Rectangle implements Shape
class: | Rectangle.java | |
methods: | constructor area() getX() getY() getWidth() getHeight() area() |
|
package: | shape.warmup | |
source folder: | student/src/main/java |
constructor
method: public Rectangle(double x, double y, double width, double height)
(sequential implementation only)
getX()
method: public double getX()
(sequential implementation only)
getY()
method: public double getY()
(sequential implementation only)
getWidth()
method: public double getWidth()
(sequential implementation only)
getHeight()
method: public double getHeight()
(sequential implementation only)
area()
method: public double area()
(sequential implementation only)
Circle
public class Circle implements Shape
class: | Circle.java | |
methods: | constructor area() getX() getY() getRadius() area() |
|
package: | shape.warmup | |
source folder: | student/src/main/java |
constructor
method: public Circle(double x, double y, double radius)
(sequential implementation only)
getX()
method: public double getX()
(sequential implementation only)
getY()
method: public double getY()
(sequential implementation only)
getRadius()
method: public double getRadius()
(sequential implementation only)
area()
method: public double area()
(sequential implementation only)
Testing Your Solution
Correctness
class: | ShapeTestSuite.java | |
package: | shape.warmup | |
source folder: | testing/src/test/java |