Problems in the Code
SRP Violated: Single Responsibility Principle
OCP Violated: Open/Closed Principle
(Other SOLID principles are not applicable yet.)
Why is SRP Violated?
Account class handles:
Balance data
Interest calculation logic
Two reasons to change = SRP violation.
SRP says: A class should have only one reason to change.
Why is OCP Violated?
Adding new account types (e.g., "Premium") needs modifying CalculateInterest.
Risk of introducing bugs while changing old code.
OCP says:
Open for extension
Closed for modification