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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 2 of 2

Thread: This might be the easiest thing to solve.

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Location
    Houston, TX
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default This might be the easiest thing to solve.

    And yet, I am lost. I need help making this method work. Everything before the comment was provided by the instructor but the rest of this method is giving me loads of trouble. I am going to try to explain this as best as I can, I am way too new at this
    On this line towards the end..

    out.printBalance(balance);
    I am getting the error "balance cannot be resolved to a variable".

    The printBalance method in the Output class was declared as
    public void printBalance(double balance)

    Here is my code


    public BankAccount handleLogin()
    {
    BankAccount account = null;

    String accountNumber = input.readAccountNumber();
    String pin = input.readPin();
    boolean valid = validateLogin(accountNumber, pin);

    //************************************************** ****
    //Write the if statement that when valid, the beginning
    //balance is read and the account object is created.
    //**************+*********************************** *****

    Output out = new Output();
    if (valid)
    {
    out.printBalance(balance);


    }



    return account;

    }


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: This might be the easiest thing to solve.

    When do you declare a variable named balance?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 2
    Last Post: September 16th, 2011, 03:32 PM
  2. need to figure how this thing will work
    By frosst in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 26th, 2011, 01:45 AM
  3. [SOLVED] Method help, one thing then another - puzzle
    By Scotty in forum Java Theory & Questions
    Replies: 3
    Last Post: April 28th, 2011, 01:52 PM
  4. Easiest transition from VBA?
    By Milothicus in forum Java Theory & Questions
    Replies: 1
    Last Post: June 12th, 2010, 03:30 PM
  5. Trying 3 different ways to do the same thing, each one is wrong
    By shemer77 in forum What's Wrong With My Code?
    Replies: 14
    Last Post: June 4th, 2010, 07:01 PM