Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Lab experiment help!

843785Jul 15 2008 — edited Jul 15 2008
hello i am having troble with the following problem:

there are 10 animals in a lab and enough food for 1000 animals. Every hour the population of animals doubles, and enough food is added for 4000 more animals. how many hours it will take for the population to outgrow outgrow the food supply. Display a line of information each time.

here is my code:
import java.awt.*;
import hsa.Console;

public class RandomNumbers
{
    static Console c;           // The output console
    
    public static void main (String[] args)
    {
        c = new Console ();
        
        int animals, food, hours;
        
        animals = 10;
        food = 1000;
        
        hours = 0;
        
        
        
        while(animals < food);
        {
            hours ++;
            
            animals = animals  * 2;
            food = food + 4000;
            
            c.println("In " + hours + "hours there are " + animals + "and food for " + food);
        }
        
             
     }         
} 
for some reason, my output screen is blank. why is this. what am i doing wrong.

Thanks

Edited by: Tradeoff on Jul 14, 2008 10:43 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2008
Added on Jul 15 2008
23 comments
238 views