Question: Define a class called Payment which contains an instance variable of type double that stores the amount of a payment. Include appropriate getter/setter methods in

Define a class called Payment which contains an instance variable of type double that stores the amount of a payment. Include appropriate getter/setter methods in your class. Include a method named paymentDetails which outputs an English sentence describing the payment. Next define a class named CashPayment which is derived from Payment. The class should redefine the paymentDetails method to indicate that the payment is cash. Include necessary constructors for this In addition to this, define a third class called CreditCardPayment that is derived from Payment. This class should contain instance variables for the: Cardholder's Name Expiration Date Credit Card Number Lastly modify the paymentDetails method on this class to include all credit card information in the printout. Include a main method in your submission (either in one of the three classes or in a separate class) which demonstrates two instances of CashPayment and at least two instances of and the different values of paymentDetails for each. Save your submissions in Payment.java, CashPayment.java and CreditCardPayment.java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
