Results 1 to 4 of 4
  1. #1
    mustachMan is offline Member
    Join Date
    Dec 2009
    Posts
    33
    Rep Power
    0

    Default What does the letters mean?

    int this code:
    Java Code:
    Item(String idIn, String nameIn, String retailIn, String quantityIn,
    			boolean noDiscountIn)
    		{
    			id = idIn;
    			name = nameIn;
    			retail = Double.parseDouble(retailIn);
    			quantity = Integer.parseInt(quantityIn);
    			noDiscount = noDiscountIn;
    			
    			if (noDiscount == true)
    				price = retail;
    			
    			
    			else if (quantity > 400 || noDiscount == false)
    				price = retail * .5D;
    			else if (quantity > 200 || noDiscount == false)
    				price = retail * .6D;
    			else if ( noDiscount == false)
    				price = retail * .7D;
    				price = Math.floor(price * 100 + .5) / 100;
    what does the letters 'D' do ?

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    > what does the letters 'D' do ?

    D tells the compiler that you mean 0.5 as a double value, not a float.

    See, for instance, Data Types in Oracle's Java Tutorial.

  3. #3
    mustachMan is offline Member
    Join Date
    Dec 2009
    Posts
    33
    Rep Power
    0

    Default

    okay thanks
    ::)

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

Similar Threads

  1. converting letters to numbers
    By fenhoff in forum New To Java
    Replies: 2
    Last Post: 01-24-2010, 05:45 AM
  2. Need help with counting letters
    By mrdestroy in forum New To Java
    Replies: 15
    Last Post: 10-22-2008, 02:33 PM
  3. Letter with Letters
    By elgatoboricua in forum New To Java
    Replies: 7
    Last Post: 09-16-2008, 03:59 PM
  4. need block letters??
    By dc2acgsr99 in forum New To Java
    Replies: 16
    Last Post: 01-29-2008, 09:31 AM
  5. adjacent repeating letters
    By artemis_r2 in forum New To Java
    Replies: 1
    Last Post: 11-17-2007, 05:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •