Advertisement
C-Squared

Chapter 8 Project 1

Nov 21st, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3. public class ComboLock
  4. {
  5.     private int firNum;
  6.     private int secNum;
  7.     private int thiNum;
  8.     private int position;
  9.    
  10.     public ComboLock(int secret1, int secret2, int secret3)
  11.     {
  12.         firNum = secret1;
  13.         secNum = secret2;
  14.         thiNum = secret3;
  15.     }
  16.     public void reset()
  17.     {
  18.         position = 0;
  19.     }
  20.     public void TurnLeft(int ticks)
  21.     {
  22.         position = ticks;
  23.     }
  24.     public void TurnRight(int ticks)
  25.     {
  26.         position = ticks;
  27.     }
  28.     public boolean open()
  29.     {
  30.         if (position == true)
  31.         {
  32.             open = true;
  33.         }
  34.         else
  35.         {
  36.             position = 0;
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement