Round 1
Questions:
Problem Statement:
Design an Order Management System for an e-commerce platform with the following features:
- Add items to the cart →
addItemToCart(userId, itemId, quantity)
- Remove items from the cart →
removeItemFromCart(userId, itemId)
- Calculate the total price →
calculateTotal(userId)
- Apply tax (10%) and discounts (5% off if total > $100)
- Checkout the cart →
checkout(userId)
Constraints:
- The system should handle multiple users independently.
- Invalid item IDs should throw an error.
- Orders above $100 should get a 5% discount.
- Prices are predefined in the system.
Candidate's Approach
This implementation supports multiple users using a HashMap
to store each user's cart. It provides essential shopping cart functionalities with tax and discount calculations.
Interviewer's Feedback
No feedback provided.