Question: You have been hired to create a payment system that supports different kinds of payments on an e-commerce site. A previous consultant has created

You have been hired to create a payment system that supports different

You have been hired to create a payment system that supports different kinds of payments on an e-commerce site. A previous consultant has created the following abstract class to handle payments: // Payment Gateway.java public abstract class Payment Gateway ( public abstract void processPayment (double amount); public abstract void refundPayment (double amount); } You have to do the following: (a) Create a class named PayPal that extends Payment Gateway. The PayPal class should have the following methods: i. A constructor that creates a PayPal object with the specified email and password. ii. A method named processPayment that prints the message "Processing payment of (amount) with PayPal for account (email)". iii. A method named refundPayment that prints the message "Refunding payment of (amount) with PayPal for account (email)".. (b) Create a class named Credit Card that extends Payment Gateway. The Credit Card class should have the following methods: i. A constructor that creates a Credit Card objct with the specified card number and expiration date. ii. A method named processPayment that prints the message "Processing payment of (amount) with Credit Card (card number) that expires on (expiration date)". iii. A method named refundPayment that prints the message "Refunding payment of (amount) with Credit Card (card number) that expires on (expiration date)". Use the following test class to test your code: // Problemi.java public class Problem! { public static void main(String[] args) { Payment Gateway paypal - new PayPal ("john.doe@marist.edu", "password"); paypal processPayment (100.00); paypal.refundPayment (100.00); Payment Gateway credit Card new Credit Card("1234567890123456", "12/2020"); credit Card.processPayment (100.00); 1 credit Card.refundPayment (100.00);

Step by Step Solution

3.52 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Given the below code for abstract class PaymentGateway PaymentGatewayjava public abstract class PaymentGateway public abstract void processPaymentdoub... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!