You have been hired to create a payment system that supports different kinds of payments on...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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); 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);
Expert Answer:
Answer rating: 100% (QA)
Given the below code for abstract class PaymentGateway PaymentGatewayjava public abstract class PaymentGateway public abstract void processPaymentdoub... View the full answer
Related Book For
Modern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
To demonstrate the ability to propose, implement, and query the database. Problem: MovinOn Inc. is a moving company that provides moving and storage services in California, Nevada, and Arizona....
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Create a weighted scoring model to determine grades for a course. Final grades are based on three exams worth 20%, 15%, and 25%, respectively; homework is worth 15%; and a group project is worth 25%....
-
On January 1, 2012, Outreach Incorporated sold services to a Canadian supply company and accepted a three-year note in the amount of 11,000 Canadian Dollars. Assume that exchange rates between the...
-
Kevin Johnson is quoted on the Starbucks website as saying, We aspire to be a place of inclusion, diversity, equity and accessibility. Explain what you think this means. How are these four concepts...
-
In 2016, a father of two minor children in Cuyahoga county, Ohio, filed a claim to determine custody of the children. At the pretrial, the father informed the magistrate he wanted to be named a legal...
-
The following are misstatements that might be found in the client's year-end cash balance (assume that the balance sheet date is June 30): 1. The outstanding checks on the June 30 bank reconciliation...
-
What are the key components of a relational database management system? Why are relational database management systems different from database models that preceded the relational model?
-
A textile company produces shirts and pants. Each shirt requires two square yards of cloth, and each pair of pants requires three square yards of cloth. During the next two months the following...
-
An ideal gas exerts 100 psig in a cylinder at 100F. What will the pressure be if the temperature is reduced to 32F?
-
Maria wants to be able yo have yearly withdrawals of $25,000 from her retirement account for a period of 30 years starting a year after she turns 65. if she is able to earn yearly. rate return of 7%...
-
Tom Suzuki's tax liability for the year is $2,450. He had $2,050 of federal income taxes withheld from his paycheck during the year by his employer and has $2,000 in tax credits. What are Tom's taxes...
-
The US had an annual inflation rate of 11%, whereas Malaysia had an annual inflation rate of 9%. Currently, a Malaysian Ringgit can be exchanged for 3.2885 US dollars. Other things being equal, how...
-
you will conduct a Micro-research project. You will make two original posts on the discussion board and two responses to your classmates during the unit. your 1st post: you will propose a simple...
-
Number of bonds issued 500 Par value per bond $1,800 Stated interest rate 4% Market/Effective interest rate 6% Issue date 1/1/X2 Due date (five year bonds) 12/31/X6 Interest is paid semi annually on:...
-
Question 3 A prescription requires 3 gr of phenolphthalein in 3 fluidounces of an emulsion. If the patient takes 4 tsp of the emulsion per dose, approximately how many milligrams of phenolphthalein...
-
CdF2 (s) Cd+ (aq) + 2 F- (aq) 1. A saturated solution of CdF2 is prepared. The equilibrium in the solution is represented above. In the solution [Cd+] eq = 0.0585 M and [F-] eq = 0.117 M. a....
-
The database you are using was developed by MicroStrategy, a leading business intelligence software vendor. The MicroStrategy software is also available on TUN. Most business intelligence tools...
-
What are SQL-92, SQL:1999, and SQL:2011? Briefly describe how SQL:2011 differs from SQD1999.
-
Drawing on material covered in prior chapters, explain the factors to be considered in deciding whether to create a key index for a table in SQL.
-
True or False: When dealing with multiple alternatives having unequal lives, the planning horizon equals the least common multiple of lives.
-
For each of the following categories, describe some of the difficulties that you would face in estimating appropriate values to be used in conducting an economic analysis. a. Cash flows b. MARR c....
-
Given the following information about sources of capital, what is the appropriate weighted average cost of capital to use in determining MARR? a. 9.87 percent b. 10.55 percent c. 12.42 percent d....
Study smarter with the SolutionInn App