Refactor cash and credit card transactions to use inheritance and polymorphism