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.

Page 1 of 2 12 LastLast
Results 1 to 25 of 26

Thread: Why so many decimal points in my basic code?

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Why so many decimal points in my basic code?

    A program I've been working on needs to calculate a number(salary), add a 10% commission to the salary and output to the user the total annual earnings. My programs gets those results, however the output shows unnecessary decimals to the final answer. I'm looking for something that looks like this 55000.00 as opposed to 55000.000000001. Can someone help me? Here's my code thus far-
    import java.util.Scanner;
     
    public class Commission{
     
        public static void main (String[] args){
            Scanner kb = new Scanner(System.in);
            Double a = 1.1, b, c;
     
            System.out.println("What is your fixed salary?");
            b = kb.nextDouble();
     
            c = b * a;
     
     
     
    System.out.println("Your fixed salary is $" + b +" "); 
     
    System.out.println("With the current commission being 10% of total sales, your total annual compensation is $" + c);       
     
        }
    }
    Last edited by helloworld922; October 28th, 2012 at 06:06 PM. Reason: please use [code] tags


  2. #2
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    Also my output looks like this-
    run:
    What is your fixed salary?
    50000
    Your fixed salary is $50000.0
    With the current commission being 10% of total sales, your total annual compensation is $55000.00000000001
    BUILD SUCCESSFUL (total time: 53 seconds)

    I'd ideally like to make the fixed salary number look like $50,000.00 instead of $50000.0 and the total annual compensation look like $55,000.00 instead of $55000.00000000001. I'm very new at Java and would appreciate basic understandable feedback. Thanks

  3. #3
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Why so many decimal points in my basic code?

    There are two things going on here. First is the way computers represent floating point numbers. There are several good articles on this topic, I'll link to one: What Every Computer Scientist Should Know About Floating Point Arithmetic.

    The basic jist is your computer can't represent every possible floating point number, and since floating point numbers are a binary format the decimal equivalent representation taking into account these gaps can often-times really long decimals (such as the $55000.00000000001 you're getting).

    Now if you don't actually care about this difference in representation vs. what's displayed (the "close enough is good enough" approach) you can simply modify the way you display your output.

    There are several ways to do this, the simplest method is to use the printf method.

    double value = 123.1234567890123456789;
     
    System.out.printf("Full computer representation: $%.14f\n", value);
    System.out.printf("Default double precision display: $%f\n", value);
    System.out.printf("Formatted to 2 decimal places: $%.2f\n", value);

     
    Full computer representation: $123.12345678901235
    Default double precision display: $123.123457
    Formatted to 2 decimal places: $123.12



    This method works, but there's a much better way to accomplish this by using the NumberFormat and DecimalFormat classes. You can create your own format or you can ask Java to give the currency format for your current local.

    NumberFormat format = new DecimalFormat(".00 USD");
    NumberFormat local = NumberFormat.getCurrencyInstance();
    System.out.println("My US dollar format: " + format.format(value));
    System.out.println("My local currency format: " + local.format(value));

     
    My US dollar format: 123.12 USD
    The built-in currency formatter: $123.12



    My local is currently in the US so it formats the currency as such. However, if you are in the UK it might give you the currency in Pounds, or you might get Yen in Japan, etc.

  4. The Following User Says Thank You to helloworld922 For This Useful Post:

    divebomb33 (October 28th, 2012)

  5. #4
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    This looks extremely helpful. The only problem I'm having is where to place the code you described in conjunction with my code. Any help you could offer would be amazing!

  6. #5
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: Why so many decimal points in my basic code?

    Here's the thing: The author of Java made it "easy" to print out numerical values as long as you don't care what they look like. If you want to print floating point numbers formatted a certain way, then you have to do a little work. Not really very much work, thanks to a couple of formatting classes, but some work.

    References:
    NumberFormat

    and

    DecimalFormat

    If you know that you want currency formatted like the U.S. (dollar sign, commas separating groups of three digits and a decimal point that is a period), and your installation has a US Locale as its default, you can try the following:

            DecimalFormat formattedDollars= new DecimalFormat("$#,##0.00");

    Then print a String with the desired dollar format with
                double price = whatever;
    .
    .
    .
                System.out.print("With DecimalFormat      : Price = " + formattedDollars.format(price));



    For programs with a more international flavor (or is it flavour?), you can use NumberFormat set to a particular Locale. For example to print currency using German convention (periods separate groups of three digits, the "decimal point" is a comma, and it's followed by a euro sign), you could try something like the following:

    Reference: Locale

            // Get currency format for specific Locale
            NumberFormat currencyGermany = NumberFormat.getCurrencyInstance(Locale.GERMANY);

    Then print your currency value with something like
                System.out.print("With German NumberFormat: Price = " + currencyGermany.format(price));

    References:

    I made a little program that added 10% handling charge to the basic price of goods and printed the results for a number of prices starting at 0.10:

    The lines labelled "Without format" were printed the naive way, starting with
                System.out.print("Without format          : Price = $" + price);

    For those statements, Java chooses a "generic" format that it deems reasonable, and the user doesn't have to worry about it, but the user has no control either.



    Here's the output:
    Without format          : Price = $0.1, Total = $0.11000000000000001
    With DecimalFormat      : Price = $0.10, Total = $0.11
    With German NumberFormat: Price = 0,10 €, Total = 0,11 €
     
    Without format          : Price = $1.1, Total = $1.2100000000000002
    With DecimalFormat      : Price = $1.10, Total = $1.21
    With German NumberFormat: Price = 1,10 €, Total = 1,21 €
     
    Without format          : Price = $11.1, Total = $12.21
    With DecimalFormat      : Price = $11.10, Total = $12.21
    With German NumberFormat: Price = 11,10 €, Total = 12,21 €
     
    Without format          : Price = $111.1, Total = $122.21000000000001
    With DecimalFormat      : Price = $111.10, Total = $122.21
    With German NumberFormat: Price = 111,10 €, Total = 122,21 €
     
    Without format          : Price = $1111.1, Total = $1222.21
    With DecimalFormat      : Price = $1,111.10, Total = $1,222.21
    With German NumberFormat: Price = 1.111,10 €, Total = 1.222,21 €
     
    Without format          : Price = $11111.1, Total = $12222.210000000001
    With DecimalFormat      : Price = $11,111.10, Total = $12,222.21
    With German NumberFormat: Price = 11.111,10 €, Total = 12.222,21 €
     
    Without format          : Price = $111111.1, Total = $122222.21000000002
    With DecimalFormat      : Price = $111,111.10, Total = $122,222.21
    With German NumberFormat: Price = 111.111,10 €, Total = 122.222,21 €
     
    Without format          : Price = $1111111.1, Total = $1222222.2100000002
    With DecimalFormat      : Price = $1,111,111.10, Total = $1,222,222.21
    With German NumberFormat: Price = 1.111.111,10 €, Total = 1.222.222,21 €
     
    Without format          : Price = $1.11111111E7, Total = $1.222222221E7
    With DecimalFormat      : Price = $11,111,111.10, Total = $12,222,222.21
    With German NumberFormat: Price = 11.111.111,10 €, Total = 12.222.222,21 €


    The statements that define the DecimalFormat and the NumberFormat can appear (once) in the program block, anywhere before they are used in the print statements. (So, for example, if the values are being printed in main(), you can put the format definition statements at the beginning of main().)



    Cheers!

    Z
    Last edited by Zaphod_b; October 28th, 2012 at 07:48 PM.

  7. The Following User Says Thank You to Zaphod_b For This Useful Post:

    divebomb33 (October 28th, 2012)

  8. #6
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    Can either of you show me how I incorporate your suggested code into what I already have in my first post? Thanks in advance!

  9. #7
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Why so many decimal points in my basic code?

    If you don't want to type it out, just copy/paste the sample code we've provided into your program. You'll have to modify the code slightly to get it to display the message you want and change variable names, but there really should be plenty of information available here for you to experiment and test with until you get something that works how you want it to. Try it out and if you're still having troubles ask about those specific problems you're having.

  10. #8
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    The problem I'm having is each of you pointed out several techniques to help me get my desired results. I'm so new at this that I have no idea where the suggested code might go in conjunction to my initial code.

  11. #9
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    I've been trying to add the code mentioned but I'm struggling to put it in the right places.

  12. #10
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Why so many decimal points in my basic code?

    Where have you tried putting the code? What does the compiler/program output tell you?

  13. #11
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    Here's what I tried recently-
    import java.util.Scanner;
     
     
    public class Commission{
     
        public static void main (String[] args){
            Scanner kb = new Scanner(System.in);
            double a = 1.1, b, c;
     
     
            DecimalFormat formattedDollars= new DecimalFormat("$#,##0.00");
            double value = whatever;
     
            System.out.println("What is your fixed salary?");
            b = kb.nextDouble();
     
            c = b * a;
     
    System.out.print("With DecimalFormat      : Value = " + formattedDollars.format(value));        
    System.out.println("Your fixed salary is $" + b +" "); 
    System.out.println("With the current commission being 10% of total sales," +
    "your total annual compensation is $" + c);               
     
        }
    }

    I know I have to reconfigure my System.out code but I'm not sure where I'm screwing up here. The compiler gives me a runtime exception
    Last edited by helloworld922; October 29th, 2012 at 06:12 PM.

  14. #12
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    I also found this link which looked helpful but again don't grasp where to put code like this with my code
    Make cents with BigDecimal - JavaWorld

  15. #13
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: Why so many decimal points in my basic code?

    Quote Originally Posted by divebomb33 View Post
    Here's what I tried recently
    .
    .
    .
    runtime exception
    That code will not compile, so I can't see how it could be giving a runtime exception. For best chances of getting helpful responses with fewest iterations it is recommended to post the exact code that you are trying to use.


    Cheers!

    Z
    Last edited by Zaphod_b; October 29th, 2012 at 11:01 AM.

  16. #14
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    Here is what I have so far that is fully functional. All I'd like to do is possibly add-
    import java.text.DecimalFormat;
    import java.text.NumberFormat
    in conjunction with what I already have. My programs outputs results numbers with decimal points all over the place.
    Here is what I have so far that is fully functional-

    import java.util.Scanner;
     
     
    public class Commission{
     
        public static void main (String[] args){
            Scanner kb = new Scanner(System.in);
            double a = 1.1, b, c;
     
     
     
     
            System.out.println("What is your fixed salary?");
            b = kb.nextDouble();
     
            c = b * a;
     
     
    System.out.println("Your fixed salary is $" + b +" "); 
    System.out.println("With the current commission being 10% of total sales," +
    "your total annual compensation is $" + c);               
     
        }
    }

    I found this on site and think something similar would work with my program. Just confused where to put it and what variable to change-
    package org.kodejava.example.text;
     
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
     
    public class DecimalFormatExample
    {
        public static void main(String[] args)
        {
            // We have some millons money here that we'll format its look.
            double money = 100550000.75;
     
            // By default to toString() method of the Double data type will print
            // the money value using a scientific number format as it is greater
            // than 10^7 (10,000,000.00). To be able to display the number without
            // scientific number format we can use java.text.DecimalFormat wich
            // is a sub class of java.text.NumberFormat.
     
            // Below we create a formatter with a pattern of #0.00. The # symbol
            // means any number but leading zero will not be displayed. The 0
            // symbol will display the remaining digit and will display as zero
            // if no digit is available.
            NumberFormat formatter = new DecimalFormat("#0.00");
     
            // Print the number using scientific number format.
            System.out.println(money);
     
            // Print the number using our defined decimal format pattern as above.
            System.out.println(formatter.format(money));
        }
    }
    Last edited by helloworld922; October 29th, 2012 at 06:13 PM.

  17. #15
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    Any help guys?

  18. #16
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: Why so many decimal points in my basic code?

    Quote Originally Posted by divebomb33 View Post
    ...

    I found this on site and think something similar would work with my program. Just confused...
    As documented in the links that I gave in my first post:
    The static format method of the NumberFormat returns a String. The static format method of the DecimalFormat classes returns a String.

    "So what?" you say.

    Well, you can use that String any way that you want to. You can put it in a print statement or whatever.

    Question: In your last sample program, what does the following statement do?
        // Print the number using our defined decimal format pattern as above.
        System.out.println(formatter.format(money));
    Answer: Prints the numerical value as a String according to the formatter definition, right?


    Next Question: What does the following statement do?
        System.out.println("money = $" + formatter.format(money));
    Answer: Try it.


    Then go back and look at the output statements that I showed in my first post.



    Cheers!

    Z
    Last edited by Zaphod_b; October 29th, 2012 at 12:42 PM.

  19. #17
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    I made the following changes but they still yield this output message
    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
    symbol: class DecimalFormat
    location: class Commission
    at Commission.main(Commission.java:17)
    Java Result: 1

    What am I doing wrong?

    Here is the whole code I ran-
    import java.util.Scanner;
     
     
    public class Commission{
     
        public static void main (String[] args){
            Scanner kb = new Scanner(System.in);
            double a = 1.1, b, c;
     
            DecimalFormat formattedDollars= new DecimalFormat("$#,##0.00");
     
     
     
     
     
            System.out.println("What is your fixed salary?");
            b = kb.nextDouble();
     
            c = b * a;
    System.out.print("With DecimalFormat      : Price = " + formattedDollars.format(price));        
    System.out.println(formatter.format(money)); 
    System.out.println("money = $" + formatter.format(money));
    System.out.println("Your fixed salary is $" + b +" "); 
    System.out.println("With the current commission being 10% of total sales," +
    "your total annual compensation is $" + c);  
     
     
        }
    }
    Last edited by helloworld922; October 29th, 2012 at 06:14 PM.

  20. #18
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: Why so many decimal points in my basic code?

    Quote Originally Posted by divebomb33 View Post
    I made the following changes but they still yield this output message
    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
    symbol: class DecimalFormat
    DecimalFormat and (NumberFormat) are in the java.text package, so at the beginning of your program, you can put the following statement to let Java know that's what you are going to use:
    import java.text.*;

    ...
    Quote Originally Posted by divebomb33 View Post
    What am I doing wrong?
    Aside from not realizing that you had to import the package containing the class, your code and the reasoning behind it is incomprehensible. I mean I can't comprehend what the heck you expect out of your code:
     
            // Create a DecimalFormat object named formattedDollars.  OK!
            DecimalFormat formattedDollars= new DecimalFormat("$#,##0.00");
    .
    .
    .
            // Proper use of formattedDollars object but where the heck is "price" defined?
            // And, why are you printing something labelled "Price" anyhow?  Your program
            // doesn't have anything associated with the price of anything.
            //
            System.out.print("With DecimalFormat : Price = " + formattedDollars.format(price));
    .
    .
    . 
           // Where the heck is "formatter" defined?, Where the heck is "money" defined?
            System.out.println(formatter.format(money));
     
            // Ditto
            System.out.println("money = $" + formatter.format(money));



    Cheers!

    Z
    Last edited by Zaphod_b; October 29th, 2012 at 02:10 PM.

  21. #19
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    Well I imported this-
    import java.text.*;
    I also added
    DecimalFormat formattedDollars= new DecimalFormat("$#,##0.00");
    You mentioned this to be include-
    System.out.print("With DecimalFormat : Price = " + formattedDollars.format(price));
    System.out.println(formatter.format(money));
    System.out.println("money = $" + formatter.format(money));
    What do I do with that? I already have this which outputs my results with the excessive decimal points-
    System.out.println("Your fixed salary is $" + b +" "); 
    System.out.println("With the current commission being 10% of total sales," +
    "your total annual compensation is $" + c);
    Last edited by helloworld922; October 29th, 2012 at 06:15 PM.

  22. #20
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: Why so many decimal points in my basic code?

    I gave several examples. None was intended to be dropped directly into your program, since they used different variable names and various kinds of format that might not be what you are looking for.

    My hope was (and is) that you would be able to use the examples to learn ways that you can format currency into a String that can be put into your program with whatever other adornment you see fit to add.


    Cheers!

    Z
    Last edited by Zaphod_b; October 29th, 2012 at 03:19 PM.

  23. #21
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    I understand. I believe the mod suggested I do that. What I have so far shows no errors, however the output doesn't show the way I'm looking for-

    import java.text.*;
    import java.util.Scanner;
     
     
     
    public class Commission{
     
        public static void main (String[] args){
            Scanner kb = new Scanner(System.in);
            double a = 1.1, b, c;
     
            DecimalFormat formattedDollars= new DecimalFormat("$#,##0.00");
     
     
     
     
     
     
     
     
            System.out.println("What is your fixed salary?");
            b = kb.nextDouble();
     
            c = b * a;
     
    System.out.println("Your fixed salary is $" + b +" "); 
    System.out.println("With the current commission being 10% of total sales," +
    "your total annual compensation is $" + c);  
     
     
        }
    }
    The imports are correct I believe. I think my problem is fixing the System.out.println code that I currently have in there. I'm just not sure what to do. I've reviewed all the previous posts over and over again. I'm really struggling with this.
    Last edited by helloworld922; October 29th, 2012 at 06:16 PM.

  24. #22
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Why so many decimal points in my basic code?

    Please use code tags in your posts, it makes it much easier to read your code.

    How to do this:

    [code=java]
    // your code goes in here
    [/code]

    This looks like:

    // your code goes in here

    You've created your DecimalFormat object, now you need to use it. DecimalFormat has a method called format. This takes a number input and formats it as a String. You can the print this String out as you would any other String.

    double value = 3.45123;
    DecimalFormat currency= new DecimalFormat("$#,##0.00");
     
    String value_as_string = currency.format(value);
     
    System.out.println("The formatted currency string is: " + value_as_string);
    System.out.println("The default formatted value is: " + value);

    You don't need to store the result of the format method into a String variable, though. You can just use it directly.

    double value = 3.45123;
    DecimalFormat currency= new DecimalFormat("$#,##0.00");
     
    System.out.println("The formatted currency string is: " + currency.format(value));
    System.out.println("The default formatted value is: " +  value);

  25. #23
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    494
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Re: Why so many decimal points in my basic code?

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/64448-have-too-many-decimals-my-basic-program-please-help.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    db


  26. #24
    Junior Member
    Join Date
    Oct 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Why so many decimal points in my basic code?

    I didn't deny getting great advice. I'm just not grasping the subject matter the way I had hoped. I'm looking for what I think is a few lines of code that will make my program work. I just don't know what exactly I'm missing and exactly where to put it in my existing code
    import java.text.*;
    import java.util.Scanner;
    //program uses scanner
     
     
    //Class declaration
    public class Commission{
     
        //main method begins program execution
     
        public static void main (String[] args){
            Scanner kb = new Scanner(System.in);
     
            double a = 1.1, b, c;
            //variables and values
     
     
            DecimalFormat formattedDollars= new DecimalFormat("$#,##0.00");
     
     
            System.out.println("What is your fixed salary?");
            //prompts user to enter their fixed salary
            b = kb.nextDouble();
     
            c = b * a;
            //this formula will determine an employee's total annual compensation
     
     
     
    System.out.println("Your fixed salary is $" + b +" "); 
    //this will print result onto output screen
    System.out.println("With the current commission being 10% of total sales," +
    "your total annual compensation is $" + c); 
    //this will print programs desired result on output screen to user
     
        }//End method display message
    }//End class Commission
    Last edited by helloworld922; October 29th, 2012 at 08:19 PM.

  27. #25
    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: Why so many decimal points in my basic code?

    I just don't know what exactly I'm missing
    Code tags?

    No one wants to read a bunch of left justified black textual code. There is even a preview button you can use to be sure the whole post looks great before posting.

Page 1 of 2 12 LastLast

Similar Threads

  1. Basic Code: Looks right, gets funky
    By EmptyArsenal in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 11th, 2012, 01:04 PM
  2. basic recursion problem - code needs to be modified
    By ash12 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 6th, 2012, 08:20 AM
  3. [SOLVED] Basic Code Problem
    By msinc210 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: June 3rd, 2012, 04:08 PM
  4. New to Java Need 2 decimal places, please :). Here is my code
    By Charyl in forum Member Introductions
    Replies: 2
    Last Post: June 28th, 2011, 03:06 AM
  5. [SOLVED] Very basic code problem
    By frederick213 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 28th, 2011, 12:33 PM