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: Java Basics Question

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Basics Question

    In the following code the for loop variable rate learns its value from an if then statement based on the input of the user. I need to modify it within the loop to use the value of the input plus the loop counter. Any help would be appreciated. Here is the section of code in question.
    if(annual + loopcounter>=(.80 * target) && annual + loopcounter <= target)
    looprate = .05;
    else if(annual + looprate>= target)
    looprate = .05 + .125;

    for(loopcounter = 5000; (loopcounter + annual) < annual * 1.5;
    loopcounter +=5000)

    // Output for table
    System.out.println((annual+loopcounter) + " \t " +
    ((annual+loopcounter) * looprate + salary));


    looprate is only being based on the initial input of annual and not of annual+loopcounter.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,771
    My Mood
    Mellow
    Thanks
    234
    Thanked 715 Times in 701 Posts

    Default Re: Java Basics Question

    Welcome to the forum! Please read the announcement topic at the top of most sub forums to learn how to properly post code and ask questions.

Similar Threads

  1. Java networking basics
    By Earthly Minds in forum Java Networking Tutorials
    Replies: 0
    Last Post: June 9th, 2013, 07:50 PM
  2. Java - The bear basics
    By Earthly Minds in forum Java Code Snippets and Tutorials
    Replies: 0
    Last Post: June 9th, 2013, 07:41 PM
  3. Java basics
    By tommyacton in forum Object Oriented Programming
    Replies: 5
    Last Post: January 5th, 2013, 06:39 AM
  4. I need help with basics.
    By Emperor_Xyn in forum Java Theory & Questions
    Replies: 8
    Last Post: December 5th, 2011, 04:09 AM
  5. Need a little help with the basics
    By Java Neil in forum What's Wrong With My Code?
    Replies: 10
    Last Post: March 17th, 2011, 10:54 PM

Tags for this Thread