C Programs Tutorials | IT Developer
IT Developer

Java Programs



Share with a Friend

Introduction to Java

Java Program: FD vs RD Interest Comparison

Assumptions / Standard Bank Formula Used

  1. Fixed Deposit (FD)

Formula:

 Fixed Deposit Formula

Where

  • P = Principal amount
  • r = Rate of interest per year
  • t = Time in years
  1. Recurring Deposit (RD)

Monthly deposit = M

 Recurring Deposit Formula

Where

  • M = Monthly deposit
  • n = Number of months
  • r = Annual interest rate

import java.util.Scanner;

 

public class FDvsRDComparison {

    public static void main(String[] args) {

 

        Scanner sc = new Scanner(System.in);

 

        System.out.println("---- FD vs RD Interest Comparison ----");

 

        // ----- FD Input -----

        System.out.print("Enter FD Principal Amount: ");

        double P = sc.nextDouble();

 

        System.out.print("Enter FD Annual Interest Rate (%): ");

        double rFD = sc.nextDouble();

 

        System.out.print("Enter Time Period for FD (in years): ");

        double t = sc.nextDouble();

 

        // ----- RD Input -----

        System.out.print("\nEnter RD Monthly Deposit Amount: ");

        double M = sc.nextDouble();

 

        System.out.print("Enter RD Annual Interest Rate (%): ");

        double rRD = sc.nextDouble();

 

        System.out.print("Enter RD Time Period (in months): ");

        int n = sc.nextInt();

 

        // ----- FD Calculation -----

        double fdInterest = P * (rFD / 100) * t;

        double fdMaturity = P + fdInterest;

 

        // ----- RD Calculation -----

        double rdInterest = (M * n * (n + 1) / 2) * (rRD / (12 * 100));

        double rdMaturity = (M * n) + rdInterest;

 

        // ----- Output -----

        System.out.println("\n-------- RESULT --------");

 

        System.out.println("FD Interest Earned     : ₹" + fdInterest);

        System.out.println("FD Maturity Amount     : ₹" + fdMaturity);

 

        System.out.println("\nRD Interest Earned     : ₹" + rdInterest);

        System.out.println("RD Maturity Amount     : ₹" + rdMaturity);

 

        // ----- Comparison -----

        System.out.println("\n------ COMPARISON ------");

        if (fdInterest > rdInterest) {

            System.out.println("FD gives MORE interest than RD.");

        } else if (rdInterest > fdInterest) {

            System.out.println("RD gives MORE interest than FD.");

        } else {

            System.out.println("FD and RD give SAME interest.");

        }

 

        sc.close();

    }

}

Output

 
OUTPUT :
---- FD vs RD Interest Comparison ----
Enter FD Principal Amount: 50000
Enter FD Annual Interest Rate (%): 6.5
Enter Time Period for FD (in years): 2

Enter RD Monthly Deposit Amount: 2000
Enter RD Annual Interest Rate (%): 6
Enter RD Time Period (in months): 24

-------- RESULT --------
FD Interest Earned     : ₹6500.0
FD Maturity Amount     : ₹56500.0

RD Interest Earned     : ₹3120.0
RD Maturity Amount     : ₹53120.0

------ COMPARISON ------
FD gives MORE interest than RD.

Explanation

  1. FD Interest Calculation

FD uses simple interest:

  • P = 50,000
  • r = 6.5%
  • t = 2 years

65000=50000+(50000×0.065×2)65000 = 50000 + (50000 \times 0.065 \times 2)65000=50000+(50000×0.065×2)

FD interest = ₹6500

  1. RD Interest Calculation

Given

  • M = 2000
  • n = 24 months
  • r = 6% per year

RD Interest Calculation

RD interest = ₹3120

Comparison

FD Interest (₹6500) > RD Interest (₹3120)
✅ FD is better in this case.