```
public static void main(String[] args){
/*The number of bacteria, B, in a culture that’s subject to refrigeration can be
approximated by this formula:
B=300000*e^-0.032t
Using this formula, write a program that prompts the user for a value of time, calculates the
number of bacteria in the culture, and displays the result. */
Scanner i=new Scanner(System.in);
double B,e=2.71828,t;
Math.pow((double)e, (double)t);
System.out.println("Please input your value of time: ");
t=i.nextDouble();
** B = (300000)*Math.pow(e),(-0.032 * t);**
System.out.println("Number of bacteria: "+B);
}
it gives me an error
how can i make a formula multiply with that e^-0.032t?
```

## Recommended Answers

Jump to PostThe easiest way to get (e to the power something) is to use

`Math.exp(something)`

, eg`eToThePowerFour = Math.exp(2*2);`

## All 4 Replies

JamesCherrill
4,394
Most Valuable Poster
Moderator
Featured Poster

reincom
0
Newbie Poster

JamesCherrill
4,394
Most Valuable Poster
Moderator
Featured Poster

reincom
0
Newbie Poster

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.