Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Task
Emulate a back ATM Machine and its features with a
class
.Requirements
Default Settings:
new ATM(usersArr)
whereusersArr
is anarray
of users{username: username, password: password, money: money}
>> atm = new ATM(users<arr)
The class will also have the following methods :
Register :
atm.register(username, password)
This adds a new user to database with
0$
money, return0
when done, return1
when user already exists.Login :
atm.login(username, password)
login a user to do action next, return
0
when done, return1
when wrong username or wrong password are givenLogout :
atm.logout()
:logout current user, return
0
when done, return1
when user already logged outQuery Stat :
ATM.query()
query account status, return
{money: money}
when done, return1
when user already logged outChange Password :
ATM.changePass(oldPass, newPass)
change password, return
0
when done, return1
when logged out, return2
when wrong old password is givenPayment :
ATM.pay(count, target)
Payment to another user registered, return new money when done, return
1
when already logged out, return2
when no enough money, return3
when target user not existGood one;) Parental supervision is the ultimate section pass in this bathhouse.
Is the bathhouse gender fluid ? ;)
Seems like to be a bug on your side OR the code indeed had the bug but got fixed
anyways, couldn't replicate that error for now
done! thanks for also providing the solution!
added tests for checking duplication
This comment is hidden because it contains spoiler information about the solution
ah i see , i will add that now. Thanks!
can you please provide an example? also should i add more test cases for duplication cases?
Cases with duplication of integers are not properly tested, and solutions, which fail example tests, may actually pass main test suite.
done!
thanks!
indention to be corrected for last line of random tests.
fixed!
thanks!
Loading more items...