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 4 of 4

Thread: My code is not working correctly

  1. #1
    Junior Member shavek911's Avatar
    Join Date
    Jul 2012
    Location
    Southeast US
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default My code is not working correctly

    Delete thread-
    Attached Images Attached Images
    Last edited by shavek911; July 18th, 2012 at 05:38 PM. Reason: Shortening and add screenshot


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

    Default Re: My code is not working correctly

    If you want help, you'll have to create an SSCCE that demonstrates the problem. That includes the input that generates the problematic output.
    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!

  3. #3
    Junior Member shavek911's Avatar
    Join Date
    Jul 2012
    Location
    Southeast US
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: My code is not working correctly

    I went ahead and cleaned up the problem. The scanner is grabbing the AnnualSales and then I am trying to calculate that by .20 with AnnualSales * commissionRate. It doesn't do it, I am not sure why.

  4. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: My code is not working correctly

    Quote Originally Posted by shavek911 View Post
    ... I am not sure why.
    You have a comment
    //this is where it wont do the math and returns 0
    beside a line, which multiplies 2 doubles, and is returning zero. One of them must be zero. Have you tested to see which is zero, and what could cause that?

Similar Threads

  1. [SOLVED] For Loop not working correctly.
    By chrisob in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 15th, 2012, 03:50 PM
  2. Classpath override not working correctly in command prompt?
    By MeteoricDragon in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 20th, 2011, 11:05 AM
  3. Hey guys, my While loop isn't working correctly.
    By metanoia in forum What's Wrong With My Code?
    Replies: 6
    Last Post: October 26th, 2011, 11:15 PM
  4. How do I embed my code correctly?
    By jwise95 in forum The Cafe
    Replies: 1
    Last Post: April 22nd, 2011, 09:36 AM
  5. Code not printing correctly
    By Movies32 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 6th, 2010, 02:59 PM