Define a class named payment that contains an instance


Question: Define a class named Payment that contains an instance variable of type double that stores the amount of the payment and appropriate accessor and mutator methods. Also create a method named payment Details that outputs an English sentence to describe the amount of the payment.

Next, define a class named Cash Payment that is derived from Payment. This class should redefine the payment Details method to indicate that the payment is in cash. Include appropriate constructor(s). Define a class named Credit Card Payment that is derived from Payment. This class should contain instance variables for the name on the card, expiration date, and credit card number. Include appropriate constructor(s). Finally, redefine the payment Details method to include all credit card information in the printout. Create a main method that creates at least two Cash Payment and two Credit Card Payment objects with different values and calls payment Details for each.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Define a class named payment that contains an instance
Reference No:- TGS02404667

Now Priced at $10 (50% Discount)

Recommended (95%)

Rated (4.7/5)