ulvis.paste.net

Paste Search Dynamic
Recent pastes
PMtoKSuccess
  1.  
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. class main
  8. {
  9.         public static void main (string[] args) throws java.lang.exception
  10.         {
  11.                 // your code goes here
  12.                 double x = .05;
  13.                 double PSuccessMOriginBad = math.pow((1.0-x), 3);
  14.                 double PSuccessMOriginGood = math.pow(((2+(1.0-x))/3), 3);
  15.                 double PMtoKSuccess = (PSuccessMOriginBad + 2 * PSuccessMOriginGood)/3;
  16.                 double PMtoKFail = 1 - PMtoKSuccess;
  17.  
  18.                 system.out.println("Membrane to KFC probability of success: " + PMtoKSuccess); // 0.9196774691358026
  19.  
  20.                 // If membrane is weighed out
  21.                 PMtoKSuccess = PSuccessMOriginGood;
  22.                 PMtoKFail = 1 - PMtoKSuccess;
  23.  
  24.                 system.out.println("Membrane to KFC probability of success if membrane is weighed out: " + PMtoKSuccess);
  25.  
  26.         }
  27. }
Parsed in 0.017 seconds