Question: (In Java) In this lab, you will be making a small class hierarchy for payment methods. A payment method is responsible for charging some amount
(In Java)

In this lab, you will be making a small class hierarchy for payment methods. A payment method is responsible for charging some amount to an account or card. A charge can either be accepted (in which case debt is added or funds are removed from an associated object), or be declined (in which case the associated object should not be altered). The charge method should return true if the charge is accepted and false otherwise. Again, no state should change in any object if the charge is not successful Before starting implementation, identify the type of object relationship in the diagram below (there are three). Categorize the relationship into inheritance, aggregation, and composition. Explain your choice to your lab instructor before you are checked off The gift card has a pre-loaded amount supplied by the constructor. A gift card can be charged as long as its balance remains non-negative. A debit card does not have a pre-loaded amount, but is linked to a bank account. The debit card can be charged as long as the bank account has a sufficient amount for the charge Once again you are responsible for writing a small test driver to show that your code works in some common cases. You should write the driver as a small scenario that a user is likely to enocunter. You do not need to utilize user input for the driver
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
