← 返回 instacart 的题目列表Banking System - Schedule and Cancel Payment
类型:online_judge
Implement a banking system with the following capabilities:
transfer: Implement the money transfer functionality.
schedule payment: Implement the scheduled payment feature, allowing users to set payments at a specific future date. Provide the implementation interface and data format.
cancel payment: Implement the functionality to cancel a scheduled payment.
Note: Implement a complete API and its invocation specifications. Provide input and output examples and test cases to validate the implementation. Support the following conditions:
Initial account balances
Transfer limits
Support for scheduled payment date-time format.
Input Example:
Initial Account Info:
Account A: 1000
Account B: 500
Transfer Requests:
transfer(Account A, Account B, 200)
schedule payment(Account A, Account B, 300, '2023-10-25')
cancel payment(Account A, '2023-10-25')
Output Example:
Transfer successful. Account balances:
Account A: 800
Account B: 700
Scheduled payment placed.
Scheduled payment canceled.
The implementation should correctly handle the above requests.
Example
Input
Accounts: A:1000, B:500
Commands:
transfer(A, B, 200)
schedule payment(A, B, 300, '2023-10-25')
cancel payment(A, '2023-10-25')