Question: - Write pre and postcondition statements for the methods specified in the Lock interface (shown below): public interface Lock { public boolean locked(); public void

- Write pre and postcondition statements for the methods specified in the Lock interface (shown below):

public interface Lock {

public boolean locked();

public void unlock(String key);

public void setKey(int code, String newKey); }

- Write a class that implements the Lock interface. Your class should include a set of instance variables, a set of constructors, and must implement the methods specified in the interface. You must also include a simple main method to demonstrate each of your methods in action.

instance variables: ____________________________________________________

constructor(s): _______________________________________________________

locked: _____________________________________________________________

unlock: _____________________________________________________________

setKey: ______________________________________________________________

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!