Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package comlock;
- import java.util.Random;
- import java.util.Scanner;
- public class comLockProgram {
- Random comboSet = new Random();
- Scanner input = new Scanner(System.in);
- int com1, com2, com3, ticks, set1, set2, set3;
- int dial = 0;
- public comLockProgram(int num1, int num2, int num3){
- //int num1 = input.nextInt();
- //int num2 = input.nextInt();
- //int num3 = input.nextInt();
- if (num1 < 0){com1 = comboSet.nextInt(39);}
- else{com1 = num1;}
- if (num2 < 0){com2 = comboSet.nextInt(39);}
- else{com2 = num2;}
- if (num3 < 0){com3 = comboSet.nextInt(39);}
- else{com3 = num3;}
- }
- //following 5 lines not needed due to changing to an electrical lock
- //public void reset(){dial = 0;}
- //public void turnLeft(int tick)
- //{dial = dial + tick;}
- //public void turnRight(int tick)
- //{dial = dial + tick;}
- public boolean open()
- {if (set1 == com1 && set2 == com2 && set3 == com3){return true;}
- else {return false;}
- }
- public void numSet(){
- set1 = input.nextInt();
- set2 = input.nextInt();
- set3 = input.nextInt();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment