The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
a) Create a class named CombinationLock that stores information about a 3-number dialing combination lock. It contain the following:
ï‚· Four private instance variables that store the 3 combination numbers required to open the lock and a Boolean variable that will indicate whether the lock is open or closed (true if open, false if closed).
ï‚·- 2 constructors:
           - default constructor - sets the 3 combination numbers to zero and marks the lock as closed.
           - three parameter constructor - sets the 3 combination numbers to the three passed integers and marks the lock as open.
ï‚·- No accessor methods
ï‚· -A Boolean mutator method called setCombination, which is a 3 parameter method and sets the 3 combination numbers to the 3 passed numbers. It can only change the combination if the lock is closed. If the lock is open it returns false as it could not change the combination. If the lock is closed it returns true after it has reset the combination.
ï‚·- A public void method called closeLock() which set the status of the lock as closed.
ï‚·- A public Boolean method isLockOpen() which returns true if the lock is open and false if it is closed.
ï‚· -A public Boolean method called openLock() which is a 3 parameter method whose purpose is to checks if the supplied combination is the correct one. If it is correct it sets the status to open and returns true. If it is incorrect it returns false.
ï‚·- A public integer method HowManyCorrect() which is a 3 parameter method. It returns the count of correct numbers in the supplied combination.
ï‚· -A toString() method to return the combination of the lock in the following format: Clockwise num1 - Counter-Clockwise num2 - Clockwise num3 where num1, num2 and num3 are the values of the instance variables corresponding to the combination which will open the lock.
ï‚· -An equals() method to test for equality of the combination of two objects of class CombinationLock. We don't care whether they are open or closed.
Â
I need help creating this class
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly