Add OOP/Java/Lab/Week6/BankDemo/BankDemo.java
This commit is contained in:
parent
cdeced26a8
commit
f8f3f0cb69
49
OOP/Java/Lab/Week6/BankDemo/BankDemo.java
Normal file
49
OOP/Java/Lab/Week6/BankDemo/BankDemo.java
Normal 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() + "%"
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user