☑Kizspy.me
7 of 7
Paper No: 1
Zoom
<<interface>>
IUtilities
+multiply EvenDigits(number: int): int
+ reverseSentence(sentence: String): String
Write a class named MyUtilities, which implements the interface IUtilities. The class MyUtilities
implements all methods in IUtilities as below:
+multiply EvenDigits(number: int): int - return the product of all even digits in the input number.
For example, if the number is 123456, it will return the product of the even digits 2*4*6. If no
even digits are found, return 1.
+
reverse Sentence(sentence: String): String - return the sentence with the words reversed in their
original order. Assume the sentence consists of words separated by spaces, and you must reverse
the words. For example, the words in the sentence Java is fun are reversed to fun is Java.
Hints: You can refer to the methods split() and join() of the String class.
The program output might look something like this:
+ 100%
Do not format the result.
Close