Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. /**
  4. A Engine class.
  5. */
  6. public class Engine
  7. {
  8.     /**
  9.     Checks if the engine is ok, if it's not it throws a EngineException.
  10.     @throws EngineException when a randomly generated double is below 0.001
  11.     */
  12.     public void engineCheck() throws EngineException {
  13.         Random random = new Random();
  14.         if(random.nextDouble() < 0.001){
  15.             throw new EngineException();
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement