Radioactive decay of radio active materials can be modeled by the equation: At =
ID: 3651927 • Letter: R
Question
Radioactive decay of radio active materials can be modeled by the equation:At = Ao*e^(-t*[log2/h])
where At is the amount of the material at time t, Ao is the original amount and h is the half-life. Technetium-99 is a radio isotope that is used in imaging of the brain. It has a half-life of 6 hours.
Write a program that collects Ao as double input. Then have your program display the level of technetium-99 remaining after every 3 hours in a 24 hour time period.
When completed, write a sentinel while loop that repeats this work until the user types in "quit".
Explanation / Answer
Please rate...
Program RadioActive.java
=====================================================
import java.util.Scanner;
class RadioActive
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
Scanner s1=new Scanner(System.in);
while(true)
{
System.out.print("Enter the value of Ao: ");
double a0=s.nextDouble();
int t;
double at;
for(t=0;t<=24;t=t+3)
{
at=a0*Math.exp(-t*((Math.log(2))/6));
System.out.println("At "+t+" hours: At= "+at);
}
System.out.print("Do you want to enter Ao once again [y for yes]: ");
String ch=s1.nextLine();
if(ch.charAt(0)!='y')break;
}
}
}
=====================================================
Sample output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.