Bird
0
0

Design a fine calculation system that applies a 10% discount if total fine exceeds $500. Which component should handle the discount logic?

hard📝 Trade-off Q8 of 15
LLD - Design — Library Management System

Design a fine calculation system that applies a 10% discount if total fine exceeds $500. Which component should handle the discount logic?

AAuthentication module
BUser interface displaying the fine
CFine calculation service after summing all fines
DDatabase storing fine rates
Step-by-Step Solution
Solution:
  1. Step 1: Identify where total fine is calculated

    The fine calculation service sums all fines and knows the total amount.
  2. Step 2: Determine where discount logic fits

    Discount depends on total fine, so it should be applied after summing, within the calculation service.
  3. Final Answer:

    Fine calculation service after summing all fines -> Option C
  4. Quick Check:

    Discount logic belongs in calculation service [OK]
Quick Trick: Apply discounts after total fine calculation [OK]
Common Mistakes:
MISTAKES
  • Putting discount in UI or DB
  • Separating discount from total calculation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes