-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainApp.java
More file actions
20 lines (17 loc) · 752 Bytes
/
Copy pathMainApp.java
File metadata and controls
20 lines (17 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.atm;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MainApp {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
WithdrawalEventPublisher publisher = (WithdrawalEventPublisher) context.getBean("WithdrawalEventPublisher");
SavingsAccount acc1 = new SavingsAccount(515, "Satya", 2000000);
SalaryAccount acc2=new SalaryAccount(503,"satya",3000000);
System.out.println(acc1);
System.out.println(acc2);
double balance=acc1.withdraw(2000);
double balance2=acc2.withdraw(50000);
publisher.publish(balance);
publisher.publish(balance2);
}
}