Question: Cpp Define a class named Payment that contains an instance variable of type double that stores the amount of the payment and appropriate accessor and
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 paymentDetails that outputs a line describing the amount of the payment. Include appropriate constructors). Next, define a class named CashPayment that is derived from Payment. This class should define the cashPaymentDetails method to indicate that the payment is in cash and include the call to the paymentDetails in the base class. Include appropriate constructors). Define a class named CreditCardPayment 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 constructors). Finally, define the CreditCardpaymentDetails method to include all credit card information and the call to the paymentDetails in the printout. Include appropriate constructor (s). Create a main function that creates at least two CashPayment and two CreditCardPayment objects with different values and calls appropriate paymentDetails methods for each
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
