PDA

View Full Version : Help with Java bacteria colony problem

CharGP02A
04-20-2009, 03:59 AM
This thing is due Wednesday and I have NO clue on how to do this. I don't even know where to start. This is what I have to do:

If a colony of bacteria grows at the rate of 9% per hour, then in eight hours the colony will double its size. Thus, the doubling time is eight hours. The so-called rule of 72 can be used to compute doubling times. If a quantity grows by R percent in a single period of time, then the number of periods required for the quantity to double is approximately 72/R. Given the growth rate and the original quantity, print the hourly size of the bacteria colony until it doubles. Have the computer compare the doubling time found by the rule-of-72 approach with the answer determined iteratively from the growth rate.

Read the hourly growth rate (as a decimal) and the colony size in individuals. Print meaningful headers. For each hour, print the number of the hour just ended, the initial colony size for that hour, and the new colony size computed from the rate of growth. Repeat until the colony has at least doubled. Interpolate your final hour, and beginning and ending colony sizes to get the doubling times in hours. Then computer the doubling size using the rule of 72. At the end, print both doubling times, to the nearest tenth, with appropriate labels.

Write a class method to compute each hour's growth in population by the growth-rate method. Write a class method to compute the doubling time using the rule of 72. Use formatted print statement(s), centering the computed data under their headings. Spread the headings and columns out so that the output is easy to read. Make sure no Java line is so long that it wraps when you print it.

I also HAVE to use Eclipse because that is all we have to use at the school and that's all the teacher was teaching us with. I appreciate everyone who comes in and helps me out. I have no clue where to start and end this thing and I have barely understood Java from where we started like a month ago.