From f8f3f0cb692d816c1215ed76b8d67a5ebbf46e62 Mon Sep 17 00:00:00 2001 From: Aadit Agrawal Date: Sat, 14 Sep 2024 01:51:33 +0530 Subject: [PATCH] Add OOP/Java/Lab/Week6/BankDemo/BankDemo.java --- OOP/Java/Lab/Week6/BankDemo/BankDemo.java | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 OOP/Java/Lab/Week6/BankDemo/BankDemo.java diff --git a/OOP/Java/Lab/Week6/BankDemo/BankDemo.java b/OOP/Java/Lab/Week6/BankDemo/BankDemo.java new file mode 100644 index 0000000..4a41fc9 --- /dev/null +++ b/OOP/Java/Lab/Week6/BankDemo/BankDemo.java @@ -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() + "%" + ); + } +}