Kizspy.me
3 of 3
Paper No: 2
Question 3:
(3 marks) Write a class Radio with the following information:
-content:String
-rate:int
+Radio ()
Radio
+Radio (content:String, rate:int)
+getContent():String
+getRate():int
+setContent(content:String):void
+setRate(rate:int):void
Where:
getContent():String - return content.
getRate():int-return rate.
setContent(content:String): void-update content.

setRate(rate:int): void-update rate.
The interface IRadio below is already compiled and given in byte content format, thus you can use it
without creating IRadio.java file.
import java.util.List;
public interface IRadio {
}
public int f1(List<Radio>t);
public void f2(List<Radio> t);
public void f3(List<Radio> t);
Zoom
Write a class MyRadio, which implements the interface IRadio. The class MyRadio implements methods
f1, f2 and f3 in IRadio as below (you can add other functions in MyRadio class):
f1: Find the maximum rate of all radios in the list where the content contains at least one digit.
• f2: Sort the elements that the radio content starts with a non-digit number in the list ascendingly
+ 100%
Close