April 19th, 2009, 11:33 PM #1
- Join Date
- Apr 2009
Java help request with bacteria colony problem
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.
April 20th, 2009, 11:38 PM #2
- Join Date
- Jun 2004
My recommendation if you really don't even have any idea where to start would be to ask your teacher for help.
I'll give you a little nudge though. Break it down into steps. Do you understand the rule of 72? Do you understand how to get the input? Do you understand how to get the population growth mathematically by the hour?
Break it down into steps that you can manage. Then go through and code them one by one.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By cowgirl1976 in forum Webmastering and ProgrammingReplies: 1Last Post: April 20th, 2009, 11:16 PM
By no1_vern in forum DebateIMO: Politics, Religion, ControversyReplies: 2Last Post: February 2nd, 2009, 02:11 PM
By TrendyMartini in forum IMO CommunityReplies: 3Last Post: May 22nd, 2007, 02:34 PM
By no1_vern in forum IMO CommunityReplies: 2Last Post: August 8th, 2005, 07:22 AM
By butch81385 in forum General Gaming DiscussionReplies: 202Last Post: May 14th, 2005, 04:31 PM