Files
OOPS-lab-codes/BankProject/BankDemo.java
T
2025-12-17 16:39:23 +05:30

40 lines
1.1 KiB
Java

import accounts.Account;
import java.util.Scanner;
import services.Interest;
public class BankDemo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter Account Number: ");
int accNo = sc.nextInt();
sc.nextLine();
System.out.print("Enter Customer Name: ");
String name = sc.nextLine();
System.out.print("Enter Initial Balance: ");
double balance = sc.nextDouble();
Account acc = new Account(accNo, name, balance);
System.out.print("Enter amount to deposit: ");
double dep = sc.nextDouble();
acc.deposit(dep);
System.out.print("Enter amount to withdraw: ");
double wd = sc.nextDouble();
acc.withdraw(wd);
Interest interest = new Interest();
double updatedBalance = interest.applyInterest(acc.getBalance());
System.out.println("\n--- Account Details After Interest ---");
acc.displayAccountDetails();
System.out.println("Balance after interest: " + updatedBalance);
sc.close();
}
}