Add OOP/Java/Lab/Week6/BankDemo/BankDemo.java

This commit is contained in:
Aadit Agrawal 2024-09-14 01:51:33 +05:30
parent cdeced26a8
commit f8f3f0cb69

View File

@ -0,0 +1,49 @@
class Bank {
double getRateOfInterest() {
return 0.0;
}
}
class SBI extends Bank {
double getRateOfInterest() {
return 8.0;
}
}
class ICICI extends Bank {
double getRateOfInterest() {
return 7.0;
}
}
class AXIS extends Bank {
double getRateOfInterest() {
return 9.0;
}
}
public class BankDemo {
public static void main(String[] args) {
Bank bank;
bank = new SBI();
System.out.println(
"SBI Rate of Interest: " + bank.getRateOfInterest() + "%"
);
bank = new ICICI();
System.out.println(
"ICICI Rate of Interest: " + bank.getRateOfInterest() + "%"
);
bank = new AXIS();
System.out.println(
"AXIS Rate of Interest: " + bank.getRateOfInterest() + "%"
);
}
}