PRO192_-_PE_-_SP_2025_3457.webp
Sakura_chan

PRO192_-_PE_-_SP_2025_3457.webp

Kizspy.me
Question 2:
(3 marks) Write a class Radio and a class SpecRadio extending from Radio (i.e. Radio is a superclass
and SpecRadio is a subclass) with the following information:
Radio
Where:
2 of 2
Paper No: 2
-content:String
-rate:int
+Radio()
+Radio(content:String, rate:int)
+getContent():String
+getRate():int
+setContent(content:String):void
+toString():String
getContent():String-return content.
⚫ getRate():int-return rate.
setContent(content:String):void - update content.
.toString():String - return the string of format:
content, rate
SpecRadio
-chanel:String
+SpecRadio()
+SpecRadio(content:String, rate:int,
chanel:String)
+getChanel():String
+toString()):String
+setData():void
+getValue():String
Where:
.toString():String return the string of
format:
content, chanel, rate
.getChanel():String return chanel.
setData():void Remove the first digit in
the content string.
getValue():String Check if the rate is
an odd number then return content.
after removing characters at odd indices
(1-based) from content, otherwise
return content.
Zoom
The program output might look something like:
Enter content: love Enter content: 2love3 Enter content: love
+100%
Enter content: love
Close
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
Sakura_chan
Ngày thêm
Lượt xem
5,490
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom