The blanks are filled in in the program below.
The program uses variables lockFirst, lockSecond,
and lockThird rather than using literal integer
values so that the programmer can easily change the combination.
import java.io.*; class ComboLock { public static void main ( String[] args ) throws IOException { int lockFirst = 6, lockSecond = 12, lockThird = 30; // The combination int numb; // a user-entered number BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) ); String input; boolean correct = true; //First Number System.out.println("Enter first number: "); input = stdin.readLine(); numb = Integer.parseInt( input ); if ( numb != lockFirst ) // numb NOT EQUAL to lockFirst correct = false ; //Second Number //Third Number //Result if ( correct ) System.out.println("Lock opens"); else System.out.println("Lock does not open"); } }
The program needs to deal with the next two numbers of the combination.