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 existIs the bathhouse gender fluid ? ;)
Typo in the description (3 times):
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Second and third sample tests seem to be wrong :
[(-2, 5), (4, -1), (4, 11), (10, 5)]
[(260, 120), (264, 92), (264, 148), (280, 60), (280, 180), (300, 40), (300, 200), (332, 24), (332, 216), (360, 20), (360, 220), (388, 24), (388, 216), (420, 40), (420, 200), (440, 60), (440, 180), (456, 92), (456, 148), (460, 120)]
There are many ways to sort an array, you have to be explicit.
Use katex for math formulas :
Description has be rewritten to correspond to actual quality standards.
In light mode, your example is hard to see.
This one is crazily cool and rewarding. It should be translated to
Python
by a someone.I tried to reduce my code for days, not understanding why my formula was wrong!
In the sample tests
tester("11000", "01111", 4, 1)
:Isn't it :
To prevent bad understanding, maybe add in the description that indices are
1-based
in your sample tests.Cool, but the output should be a
string
.Is not a very useful message!
This comment is hidden because it contains spoiler information about the solution
Loading more items...