Question: AP CS A JAVA: Create a program that will use the following abstract class to implement a combination lock. Your program should start by setting
AP CS A JAVA:
Create a program that will use the following abstract class to implement a combination lock. Your program should start by setting a combination and locking the lock. You should be able to check to see if the lock is locked, and try to unlock the lock using a combination. You should print out a message stating whether or not the person successfully unlocked the lock or not.

public abstract class I ComboLock { public boolean locked; public int[] locked; // method will set the combination of a lock abstract public void setcombo (int numi, int num2, int num3); public boolean isLocked () { return locked; } // method will check to see if the combination matches. If yes it will // unlock the lock, if no it will leave it locked. abstract public void unlock (int numi, int num2, int num3); public void lock() { locked=true; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
