Results 1 to 4 of 4
  1. #1
    roggoblue is offline Member
    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    Default Another noob to Java

    I am writing a program to calculate and display population growth for 5 years. Assuming that there is a birth every 7 seconds, a death every 13 seconds, and an immigrant every 45 seconds. I am using 31536000 seconds for the year and doing division. Without using a modulus operator I am getting the correct answer for the first year and I lose one the second year, two the third year, and so on. When I try to you the modulus operator, it is giving me too many numbers. I know where I am losing the numbers on the first try because the remainder when dividing by 7 is .85 and dividing by 13 is .15. How can I avoid this. Thanks

  2. #2
    StormyWaters is offline Senior Member
    Join Date
    Feb 2009
    Posts
    304
    Rep Power
    6

    Default Re: Another noob to Java

    Can you show what you have tried? Remember to use the [CODE] Tags so that it is easier to read.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: Another noob to Java

    Please go through the Forum Rules, particularly the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default Re: Another noob to Java

    You need to pass on the fractions into the following year.
    Please do not ask for code as refusal often offends.

Similar Threads

  1. Help with GUI - Java NOOB :(
    By bdelarosa7 in forum New To Java
    Replies: 3
    Last Post: 11-22-2011, 09:54 PM
  2. Noob + Java = Questions;
    By Webstorms in forum New To Java
    Replies: 1
    Last Post: 09-24-2011, 02:59 PM
  3. Help im a noob.. a super noob on java..
    By critdevil in forum New To Java
    Replies: 12
    Last Post: 03-07-2009, 03:17 AM
  4. Hello, Java Noob
    By furry in forum Introductions
    Replies: 0
    Last Post: 10-07-2008, 07:39 PM
  5. Ah! Help a Java Noob
    By Snejana in forum New To Java
    Replies: 4
    Last Post: 01-24-2008, 03:52 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
  •