1. Engineering
  2. Computer Science
  3. picombinationjava sublime text unregistered file edit selection find view...

Question: picombinationjava sublime text unregistered file edit selection find view...

Question details

piCombination.java - Sublime Text (UNREGISTERED) File Edit Selection Find View Goto Tools Project Preferences Help combinationjava ΧQ3Arfa xDoorl ock.java Ticket java 1 public class Combination int first; int second; int third; public Combination( int first, int second, int third ) 1 4. this.first first; this.second second this.third third 10 public boolean equals( Combination other) if (othernull) 12 13 14. 15 16 17 18 19 20 21 return false; else if (other.first first&& other.second second && other.third third) return true; else return false; public String toString() return first +:second : third 23 24 Line 5, Column 51 Soaces: 4 3:14 PM Type here to search 1/22/2019D Lab 2 IT111 21 ABIC] Introc × 闻Fullscreen Pageflip Layout v- x + 俞www.site.uottawa.ca/~gy/C X > Prime Video ← → С ⓘN ot securewww.site.uottawa.ca/ gy Courses IT 1 121/ Q ☆ Ο ← -) c ⓘNot secure www site uottawa.ca/gv Courses IT 1121/ Q ☆ 。 public lass DoorLack i Conctant public satic final int HAX NUMBLROF ATTLMPTS 3 Create animplementation for the class DoorLock described below. 1. declare an integer constant, called MAX NUMBER OF ATTEMPTS, that you will initialize to the value 3; 2. instance variables. The class DoorLock must havc the neccssary instance variables to Instanco variables prtvato Lonhination carbination private hoolean open private int nuberofnttenpts; i. storc an object of thc class Combination i. lo represeril the properly of beirg opeed or closed ill, to represent its activation state (the door lock is activated or deactivated. and iv. to couint the number of unsuccessful attempts at openin the door; on-Lructur, public DvorLuck Conbinatin conbinstion Your code here Accoss ricthads public bcolean 1s0pcn) f 3. he cless has a single cons Lr uclo, DoorLock( Combination combination) which initielices lhis inslance wilh a return apen; combination.When a door lock is first created, the door lck is closed. Also, when the object is first created, it is activated and the number of failed attempts at opening it should be zero; 4, implernent the instance melhod public boolean IsOpen() that returns true if this door lock is currently opened 5, implernent the instance melhod public boolean isActivated that returns true if this door lock is currently 6. implement the instance method public void activate(Combination c) that scts the instance variable activated 7. finally, implement the instance method public boolean open( Combination combination)such that and false otherwise; // Nu Lite Ual unter DFALl_enpLs 1, Lurc.ared to NAX NUMBER OF ATTEMPTS unly when its value tes been incrented, Also, nmbe OfAttenpts should be set to zero when activated and false otherwise; // 큐ctivated is false. Proolens re1ated to the contined action of these two variables have caued problens for e students o rue il Lhe paraelr cequals lo lhe combinalion of Lhis object; public bcolean cpen Conbination comtination 1 Put your code hare, then rerave the lina balcw return trua; i. an attempt is made at opening this door lack only if this door lock is activated i. it the parameter combination equals to the combination of this door lock, set the state of the door to be open, and the number of failed attempts should be reset to zero public void activate( rosn1nationぐ) ( Put your code her, then reave this coment iii. otherwise, lL.İf the wrong Combination was supplied, the number of failed attempts should be incremented by one, iv. if the number of failcd attempts rcachcs MAX NUMBER OF ATTEMPTS, this door lock should bc 12:38 AM Type here to search 1/22/2019

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution