PRO192_-_PE01_-_SU_2025_4004.webp
white_cloud1

PRO192_-_PE01_-_SU_2025_4004.webp

☑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
Chưa có bình luận nào.

Thông tin

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

Share this media

Back
Bên trên Bottom