AssignmentS2
This commit is contained in:
17
assignments/AssigmentS2/exercise2/Rectangle.java
Normal file
17
assignments/AssigmentS2/exercise2/Rectangle.java
Normal file
@ -0,0 +1,17 @@
|
||||
class Rectangle implements Shape {
|
||||
|
||||
private double n, m;
|
||||
|
||||
public Rectangle(double n, double m) {
|
||||
this.n = n;
|
||||
this.m = m;
|
||||
}
|
||||
public double calculateArea() {
|
||||
return n*m;
|
||||
}
|
||||
|
||||
public double calculatePerimeter() {
|
||||
return 2*n+2*m;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user