3 of 3 Paper No: 7
Question 3:
(3 marks) Write a class Wall with the following information:
Wall
Where:
-place:String
getPlace():String - return place.
-area:int
getArea():int-return area.
+Wall (0)
setPlace(place:String): void - update place.
+Wall (place:String, area:int)
+getPlace():String
setArea(area:int): void - update area.
+getArea():int
+setPlace(place:String):void
+setArea(area:int):void
The interface IWall below is already compiled and given in byte code format, thus you can use it without creating IWall.java file.
import java.util.List;
public interface IWall {
public int f1(List<Wall> t);
public void f2(List<Wall>t);
public void f3(List<Wall>t);
}
Write a class MyWall, which implements the interface IWall. The class MyWall implements methods f1,
Close
+ 95%
Zoom