Question 2:
(3 marks) Write a class Wall and a class SpecWall extending from Wall (i.e. Wall is a superclass and
SpecWall is a subclass) with the following information:
Wall Where:
2 of 2
Paper No: 7
-place:String-area:int
getPlace():String - return place.
getArea():int-return area.
+Wall()
setPlace(place:String):void - update place.
+Wall(place:String, area:int)
toString():String-return the string of format:
+getPlace():String+getArea():int
place, area
Where:
+setPlace(place:String):void
+toString():String
SpecWall
toString():String return the string of
format:
-color:String
place, color, area
+SpecWall()
setData():void Remove the place
+SpecWall(place:String, area:int, color:String)
+toString():String
characters that are not the alphabets.
• getValue():String - Check if the area not
divisible by the length of the place then
return color, otherwise return color+x
(x is the result of dividing the area by
the length of the place, taking the
integer part).
Zoom
+setData():void
+getValue():String
85%
Close