(3 marks) Write a class Car and a class SpecCar extending from Car (i.e. Car is a superclass and
SpecCar is a subclass) with the following information:
-color:String
-seat:int
Car
Where:
.
getColor():String - return color.
getSeat():int-return Seat.
2 of 2
+Car()
Paper No: 3
+Car(color:String, seat:int)
+getColor():String
+getSeat():int
+setColor(color:String):void

setColor(color:String):void - update color.

toString(): String-return the string of format:
color, seat
+toString():String
SpecCar
-model:String
+SpecCar()
+SpecCar(color:String, Seat:int, model:String)
•
+getModel():String
+toString():String
+setData():void
+getValue():String
Zoom
- FUO
+ 100%
.
Where:
toString():String return the string of
format:
color, seat, model
getModel():String - return model.
setData():void Remove the first letter
in the color string.

getValue():String - Check if the seat is
an odd number then return model after
removing characters at odd indices (1-
based means i+1, ex: bmw have 3
characters and the character 'b' is 1, 'm'
is 2...) from model, otherwise return
Close