Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 07 Feb 2013
Offline Last Active Apr 07 2013 03:58 PM

#5031640 Output Question

Posted by olivaw on 12 February 2013 - 06:50 PM



  In Java, the way you write constants define their types. When you write "86400/7", the compiler understands that the two numbers are integer and the result should be integer also, so instead of getting "12342.85714285714" into "birth" you are getting only "12342".


  Try to write your constants differently: instead of 86400, use 86400.0 or 86400d.


  Take a look here, in the topic "Floating-point literals".


Hope this helps.