Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Using Java Define a class named Payment that contains an instance variable "paymentAmount" (non-static member variable) of type double that stores

Using Java

Define a class named Payment that contains an instance variable "paymentAmount" (non-static member variable) of type double that stores the amount of the payment and appropriate accessor (getPaymentAmount() ) and mutator methods. Also make a method named paymentDetails that outputs an English sentence to describe the amount of the payment. Override toString() method with contents of payment amount and details.

Next, define a class named CashPayment that is derived from Payment. This class have an additional instance variable of type String (a non-static member variable) that specifies a type of currency, such as "dollar", "euro", "peso", "yen", etc. This class should redefine the paymentDetails method to indicate that the payment is in cash, and type of currency. Include appropriate constructor(s). Override toString() method with contents of payment details.

Define a class named CreditCardPayment that is derived from Payment. This class should contain instance variables (member variables) for the name on the card, expiration date, and credit card number. Include appropriate constructor(s). Finally, redefine thepaymentDetails method to include all credit card information in the printout.

Override toString() method with contents of cash payment details.

make a PayTester class with main method that creates at least two CashPayment and two CreditCardPayment objects with different values. Set payment for two objects by using setPaymentAmount() (mutator) method. Call toString() methods from each object to get the details of payments.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question