# I don't understand what I'm supposed to do

• May 11th, 2011, 01:13 AM
dmcettrick
I don't understand what I'm supposed to do
I have to write a java program for a class and I'm not sure about what to do for one of the methods. The program is for equations in the form ax + by = c. A, b, and c are the coefficients and constant. I have the rest of the program written but I don't understand this method: The verifySolution method verifies that the equality in the equation is correct with the provided x and y parameter values. It returns a value of true if the solution is correct and false otherwise. My code:
public boolean verifySolution (Equation e)
{
if ()
return true;
else
return false;
}

I'm not sure what to put in the if statement. Two of the other methods are solve for x and solve for y. I think those somehow come into the code. In the test case provide one of the tests is:
pubilc void testSolvingPairs()
{
try {
Equation uut1 = new Equation (1 , -1 , 4) ; Equation uut2 = new Equation (1 , -1 , 2) ; assertEquals(3.0 , uut1. solveForXWith(uut2) , Equation.THRESHHOLD);
assertEquals(1.0 , uut1. solveForXWith(uut2) , Equation.THRESHHOLD);
assertEquals(3.0 , uut2. solveForXWith(uut1) , Equation.THRESHHOLD);
assertEquals(1.0 , uut2. solveForXWith(uut1) , Equation.THRESHHOLD);
assertTrue(uut1. verifySolution(3.0 , 1 ,0)) ;
assertTrue(uut2. verifySolution(3.0 , 1 ,0)) ;
}
• May 11th, 2011, 09:34 AM
JJeng
Re: I don't understand what I'm supposed to do
You're getting 2 inputs, either through parameters or keyboard input, and you need to evaluate the equation to see if it is balanced with those inputs.... I'd also drop the if else and just return the equation.