I have written this code. The output should calculate the interest of the Bank but it gives 0.0 as output. I have created a class named as Bank and extended it in ICICI class.
import java.util.Scanner;
public class Bank
{
    static double rate;
    // n = number of years
    public  double calculateInterest( double PrincipalAmount, double n)
    {
        double interest;
        interest = (PrincipalAmount * n*rate) /100; // interest formula
        return  interest;
    }
    public static void main(String[] args)
    {
        Scanner s1 = new Scanner(System.in);
        System.out.print("Enter PrincipalAmount :" );
        double PrincipalAmount = s1.nextDouble();
        Scanner s2 = new Scanner(System.in);
        System.out.print("Enter Number of Years :" );
        double n = s2.nextDouble();
        ICICI ic;
        ic = new ICICI();// new object created of ICICI Class
        ic.rate = rate; // object call by reference
       System.out.print("Interest of ICICI is " +  ic.calculateInterest( PrincipalAmount,n));
    }
}
public class ICICI extends Bank
{
    double rate = 4;
}
 
     
     
     
     
    