Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: I don't understand what I'm supposed to do

  1. #1
    Junior Member
    Join Date
    May 2011
    Thanked 0 Times in 0 Posts

    Default 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;
    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)) ;

  2. #2
    Join Date
    Feb 2011
    My Mood
    Thanked 16 Times in 15 Posts

    Default 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.

Similar Threads

  1. I dont understand why this happens....
    By ashenwolf in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 10th, 2011, 09:31 PM
  2. I dont see why this program is not doing what it is supposed to
    By Leprechaun_hunter in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 12th, 2011, 08:24 AM
  3. Can't understand why Interfaces are there
    By vortexnl in forum Object Oriented Programming
    Replies: 9
    Last Post: February 14th, 2011, 01:06 PM
  4. 2 errors I can't understand
    By Brock in forum What's Wrong With My Code?
    Replies: 8
    Last Post: December 27th, 2010, 12:56 AM
  5. Replies: 1
    Last Post: March 15th, 2010, 10:03 PM