can you fix where im wrong i have 2/8 right now

QuestionT Write a method productisSum that takes an integer array argu nt and returns a string indicating whether the array contain two elements x and y whose product (x times y) is equal to the sum of the entire array (Nou may assume that there will be at most one such pair of elements) The two elements may have the same value but they should have different indexes in the array If the array contains two such elements, return a string “X and y where x and y are the two values The first value in the string must be the smaller of the two values. For example, in the array (13, 3 20, 3, 2, 1 you would return “2 and 3”. If there are not two such elements, return the string “none”. public static String productIsSum(int []a) int sum 0; 4 String str for (int i 0:i a.length; itt) sum= sum+ afi]; int flag 0; for (int i 0; i a.length; i++) 10 for (int j i + 1; ja.length 1; j+) 13 if((a[i] ali]) sum) 14 15 Elag 1 36 productIsSum([13,2,20,-32,3]) returned none expected 2 and 3 productisSum([13,3,20, -32,2]) returned none expected 2 and 3 productIsSum ([1]) OK productIsSum [27,21,22, 63,46,88, 22, 84,56,55]) returned 22 22 expected 22 and 22 productIsSum([-88,-48,74,33, -86,88,-31, -85,39,0, 79, 7,-24,-38,95,44,-71,24,-16, productIsSum ([-2,59,23,-76, -45, -81,-74,70,-16,-95,67,77, 8, -88, -35,47,-17,0,19] productIsSum(CE-39,9,-64,-47, 11,57,-95,-97,-41,8,-75,-16,32,-37,47,41,33, 87, -23, productIsSum(C[68,-20,93,14,58, 89, -90, 62,10, 24, -67,63,-77,-83,81,-24,-80,19] ) re 2/8 OK You must get all 8 examples correct to earn credit! Show transcribed image text QuestionT Write a method productisSum that takes an integer array argu nt and returns a string indicating whether the array contain two elements x and y whose product (x times y) is equal to the sum of the entire array (Nou may assume that there will be at most one such pair of elements) The two elements may have the same value but they should have different indexes in the array If the array contains two such elements, return a string “X and y where x and y are the two values The first value in the string must be the smaller of the two values. For example, in the array (13, 3 20, 3, 2, 1 you would return “2 and 3”. If there are not two such elements, return the string “none”. public static String productIsSum(int []a) int sum 0; 4 String str for (int i 0:i a.length; itt) sum= sum+ afi]; int flag 0; for (int i 0; i a.length; i++) 10 for (int j i + 1; ja.length 1; j+) 13 if((a[i] ali]) sum) 14 15 Elag 1 36 productIsSum([13,2,20,-32,3]) returned none expected 2 and 3 productisSum([13,3,20, -32,2]) returned none expected 2 and 3 productIsSum ([1]) OK productIsSum [27,21,22, 63,46,88, 22, 84,56,55]) returned 22 22 expected 22 and 22 productIsSum([-88,-48,74,33, -86,88,-31, -85,39,0, 79, 7,-24,-38,95,44,-71,24,-16, productIsSum ([-2,59,23,-76, -45, -81,-74,70,-16,-95,67,77, 8, -88, -35,47,-17,0,19] productIsSum(CE-39,9,-64,-47, 11,57,-95,-97,-41,8,-75,-16,32,-37,47,41,33, 87, -23, productIsSum(C[68,-20,93,14,58, 89, -90, 62,10, 24, -67,63,-77,-83,81,-24,-80,19] ) re 2/8 OK You must get all 8 examples correct to earn credit!

## Expert Answer

Answer to QuestionT Write a method productisSum that takes an integer array argu nt and returns a string indicating whether the ar…