Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

public class Uniquesum Normally, this method will compute the sum of the three p

ID: 3882410 • Letter: P

Question

public class Uniquesum Normally, this method will compute the sum of the three parameters. BUT, if one of the parameters has the same value as another parameter, then neither of the parameters should be included in the sum. If all three parameters * have the same value, then zero should be returned. param a First parameter to use in the "unique sum" calculation oparam b Second parameter to use in the "unique sum" calculation 8@param c Third parameter to use in the "unique sum" calculation @return "Unique sum" which only sums values which appear once in the three parameters. e public int computeUniqueSum(int a, int b, int c) f if(a== b) { return ; f else return c; else if (a-c) { return b; } else if (b == c) { return a; else t return a b C;

Explanation / Answer

It is giving null pointer exception because you have not initialised the 'UniqueSum' class.

Please change the line1 of UniqueSumTest class to the following:-

UniqueSum obj=new UniqueSum;