Java Program of Interest Calculator – Interface Concept


MyBank wants to create an interest calculator module to benefit the customers for checking the interest that the customer has to pay for the amount that he receives from the bank as a loan. Help MyBank in implementing the same

1. Create an interface Percentage with the below attribute and abstract method.

float rateOfInterest = 10.5 ;

double calculateInterest(double amount)  –  abstract method to calculate the interest amount for the principle amount passed as parameter and mentioned rate of interest. Return the interest amount.

Create a class called “InterestCalc” that implemets the interface “Percentage”.

Provide implementation for the calculateInterest method in the interestCalc class.

Create a class called Interest with the main method. From this main method invoke the calculateInterest method of InterestCalc class.

Display the result as shown in the sample output

Sample Input and Output :

Enter the amount for which interest must be calculated


The interest amount to be paid is



import java.util.Scanner;
interface Percentage{
    float rateOfInterest=(float)10.5;
    public abstract double calculateInterest(double amount);
class InterestCalc implements Percentage{
    public double calculateInterest(double amount){
        return amount*this.rateOfInterest/100;
public class Interest{	
	public static void main(String[] args) 
	    Scanner sc=new Scanner(;
	    Percentage i=new InterestCalc();
	    System.out.println("Enter the amount for which interest must be calculated");
	    double amount=sc.nextDouble();
	    System.out.println("The interest amount to be paid is");


  1. Interest Calculator – Interface Concept
  2. Bank – Abstract concept
  3. Inheritance – Account
  4. Contact Details of Hosteller
  5. PF and Salary Calculation
  6. Check for Existence of Customer – equals method
  7. Account Manipulation – Abstract class
  8. Employee Loan Eligibility – Polymorphism

Leave a Comment

Your email address will not be published. Required fields are marked *