Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Scanner;
- public class RateOfDecay {
- public static void main (String[] args){
- /*************************************************
- * Variables go here *
- *************************************************/
- // Large number between 10000 and 100000
- int largeInt;
- // Probability number (Not sure what is specified here)
- double probability;
- //creating the Scanner
- Scanner reader = new Scanner(System.in);
- //Taking in the large number
- System.out.println("Enter the large number:");
- largeInt = reader.nextInt();
- // PlaceHolder Number
- double newDouble = largeInt;
- // Taking in the probability
- System.out.println("Enter the probability:");
- probability = reader.nextDouble();
- /***************************************************************************
- The code below is a loop to go over the seconds.
- When each second is displayed, it indictates the number of
- atoms left.
- From what I can gather, the large input number is the number of Atoms
- of the substance that is left after a specific amount of time has passed.
- So a simple loop will do, to keep going as as long as the number is greater
- than 1/16 (0.0625) of the original mass. Multiplying the probability and the
- current large number and subtracting it from the current large number will
- whittle it down.
- **********************************READ*PLS***************************************
- * You will probably have to work a little and create your probability number *
- * This question is not complete yet. Once you have some more clarification *
- * about what the probability number is, and how it is determined, then you can *
- * just plug that into the loop down below and let it run. The Skeleton has been *
- * done for you! Good luck! *
- *********************************************************************************
- I hope that this helps!
- ***************************************************************/
- for(int i = 0; newDouble >= (0.0625 * largeInt); i++){
- newDouble = newDouble - (newDouble * probability);
- System.out.println("Second " + i + ": "+ newDouble);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement