Design a Bank Account OOP Simulation with Transfers, Payments, and Merges
Quick Overview
This Ramp software engineering question evaluates object-oriented modeling for bank accounts, transfers, payments, and merges. It is useful practice for designing clear domain objects, preserving invariants, and handling state transitions in financial product workflows.
Design a Bank Account OOP Simulation with Transfers, Payments, and Merges
Company: Ramp
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
Design an object-oriented banking simulation. Accounts can be created, balances can be queried, money can be transferred, payments can be recorded, and two accounts can be merged. The interview is staged in multiple levels, where each level unlocks new operations that should build on the previous design.
### Constraints & Assumptions
- All data can live in memory.
- Account ids are unique strings.
- Balances are integer cents.
- A merge should preserve enough history for future queries unless clarified otherwise.
### Clarifying Questions to Ask
- What exact operations are required at each level?
- Can transfers fail for insufficient funds?
- After a merge, should the old account id remain as an alias?
- Do payments have timestamps or cashback rules?
- Are operations single-threaded?
### What a Strong Answer Covers
```premium-lock What a Strong Answer Covers
```
### Follow-up Questions
- How would you add scheduled payments?
- How would cashback or rewards affect the ledger?
- How would you support account aliases after merge?
- How would concurrency change the design?
Quick Answer: This Ramp software engineering question evaluates object-oriented modeling for bank accounts, transfers, payments, and merges. It is useful practice for designing clear domain objects, preserving invariants, and handling state transitions in financial product workflows.
Design an object-oriented banking simulation. Accounts can be created, balances can be queried, money can be transferred, payments can be recorded, and two accounts can be merged. The interview is staged in multiple levels, where each level unlocks new operations that should build on the previous design.
Constraints & Assumptions
All data can live in memory.
Account ids are unique strings.
Balances are integer cents.
A merge should preserve enough history for future queries unless clarified otherwise.
Clarifying Questions to Ask
What exact operations are required at each level?
Can transfers fail for insufficient funds?
After a merge, should the old account id remain as an alias?
Do payments have timestamps or cashback rules?
Are operations single-threaded?
What a Strong Answer Covers Premium
Follow-up Questions
How would you add scheduled payments?
How would cashback or rewards affect the ledger?
How would you support account aliases after merge?