Question: A computer game usually has many different objects that can be seen and manipulated. One typical object is a door. Each door has an inscription

A computer game usually has many different objects that can be seen and manipulated. One typical object is a door. Each door has an inscription (such as Enter, Exit, Treasure, etc.) and can be in the Open or Closed state, and Locked or Unlocked state. The objective of this question is to implement a Door class that has the following: String inscription boolean locked boolean closed and the following methods: Constructor that instantiates a Door with a given inscription, closed and locked. isClosed returns true if the Door is closed isLocked returns true if the Door is locked. open opens a Door if it is closed and unlocked. close closes a Door if it is open (but does not lock it). lock locks a Door if it is unlocked. unlock unlocks a Door if it is locked (but does not open it). toString displays the inscription and whether the Door that is locked/unlocked, closed/open. If you can, please explain why you coded the program the way you did.

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!