OUTPUT:
✓ Kizspy.me
5000.00
Question 4:
6-Hoang Minh-6000.00-8
Question 04: (03 marks)
The interface IDataProcessor below is already given in Java code format, thus you can use it
without creating an IData Processor.java file.
<<interface>>
IDataProcessor
+findLargest Number(strInput: String): int
+ calculate AverageNumbers(strInput: String): double
Write a class named DataHandler, which implements the interface IData Processor. The class
Data Handler implements all methods in IData Processor as below:
+findLargest Number(strInput: String): int - return the largest integer in the string strinput
+calculateAverageNumbers(strInput: String): double return the average of all integers in the
string strinput.
Hints: Assuming that the string strinput consists of words separated by a space, a word can be a
string of letters or a string of digits (positive integer). You can refer to the split() method of the
String class.
Zoom
+100%
Close