USING JAVA(ECLIPSE) CODE THIS The payment transaction scenario could be represen
ID: 3775836 • Letter: U
Question
USING JAVA(ECLIPSE)
CODE THIS
The payment transaction scenario could be represented by the following hierarchy: Create interface class Payments with one abstract method called paymentInfo. Create classes VISA, MASTER, DEBIT that implement Payments. Foe each of the three classes (VISA, MASTER, DEBIT), create one constructor, one instant variable amount, and get balance method. Constructors are used to create objects with initial balance. The interface class method "paymentlnfo" should be overridden in the three classes (VISA, MASTER, DEBIT) to display the initial amount of each object. paymentInfo method is used to display information on the screen about the current amount. You test method should looks like: public class Demo {public static void main(String args[]) {/* Create two objects using constructor */Payments visaPymts = new VISA(100); Payments masterPymts = new MASTER(200); Payments debitPymts = new DEBIT(400);//Invoking a method for each object created visaPymts.paymentInfo (); masterPymts.paymentInfo (); debi tPymts.paymentInfo (); double total Amount - visaPymts. getAmount() + visaPymts. getAmountO + visaPymts. getAmount(); System, out.println("The total amount you paid is" + totalAmount);}} The output of the program will be like the following: You paid $100.00 using your VISA card You paid $200.00 using your MASTER card You paid $400.00 using your DEBIT card. The total amount you paid is $700Explanation / Answer
Please find the required program along with its output. Please see the comments against each line to understand the step.
-----------------------------------------------------
OUTPUT:
You paid $100.0 using your VISA card
You paid $200.0 using your MASTER card
You paid $400.0 using your DEBIT card
The total amount you paid is $700.0
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.