mirror of
https://github.com/Manoj-HV30/OOPS-lab-codes.git
synced 2026-05-16 19:35:25 +00:00
40 lines
1.1 KiB
Java
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();
|
|
}
|
|
}
|