Question
Consider the program below. Its purpose is to calculate the population of a colony of bacteria using the formula P = N e k t
Consider the program below. Its purpose is to calculate the population of a colony of bacteria using the formula P = Ne k t in a method named population, where P is the population at time t, N is the initial population at time t = 0,k is the growth rate and e is the base number of the natural number system, approximated as 2.718282. Determine the missing identifiers, symbols or numbers. Write your responses in the spaces provided.
import java.io.*; import java.math.*;
public class Population {
static BufferedReader theKeyboard = new BufferedReader(new InputStreamReader(System.in));
public static double population(double ______ , double rate, double time) { double result; result = initial * Math.exp( __________ * time); __________ result; }
public static void main(String args[]) throws IOException { double N, k, t, __________ ;
System.out.print("Find bacteria population at specified time "); System.out.print("Enter initial population -> ");
_____ = Double.parseDouble(theKeyboard.readLine());
System.out.print ("Enter growth rate -> "); k = Double.parseDouble(theKeyboard.readLine());
System.out.print ("Enter number of time periods -> ");
t = Double.parseDouble(theKeyboard.readLine());
endResult = __________(N, k, t);
System.out.println("Population after " + _____ + " time periods = "); System.out.println(endResult);
System.out.print ("Press < Return > to continue"); char s = (char)theKeyboard.read(); } }
|
You can test your program by using input values similar to those shown in this screen snapshot.
Find bacteria population at specified time
Enter initial population -> 5000
Enter growth rate -> 0.02
Enter number of time periods -> 6
Population after 6.0 time periods =
5637.484257896878
Press < Return > to continue
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started