java program to calculate compound interest

Solutions on MaxInterview for java program to calculate compound interest by the best coders in the world

showing results for - "java program to calculate compound interest"
Valentina
25 May 2020
1// Java program to find simple interest
2import java.util.Scanner;
3public class SimpleInterestJavaProgram
4{
5   public static void main(String[] args)
6   {
7      float principal, rate, time;
8      Scanner sc = new Scanner(System.in);
9      System.out.print("Enter principal amount : ");
10      principal = sc.nextFloat();
11      System.out.print("Please enter rate annually : ");
12      rate = sc.nextFloat();
13      System.out.print("Please enter time(in years) : ");
14      time = sc.nextFloat();
15      float simpleInterest;
16      simpleInterest = (principal * time * rate) / 100;
17      System.out.println("The Simple Interest is : " + simpleInterest);
18      sc.close();
19   }
20}
Gabriele
06 Apr 2020
1// Java program to calculate compound interest
2public class CompoundInterestDemo 
3{
4   public void calculateCompound(int p, int t, double r, int n) 
5   {
6      double number = p * Math.pow(1 + (r / n), n * t);
7      double interest = number - p;
8      System.out.println("Compound interest after " + t + " years: " + interest);
9      System.out.println("Money after " + t + " years: " + number);
10   }
11   public static void main(String[] args) 
12   {
13      CompoundInterestDemo obj = new CompoundInterestDemo();
14      obj.calculateCompound(200000, 6, .06, 12);
15   }
16}
queries leading to this page
how do you write compound interest formula in java 3fsimple interest java programjava program to calculate rate in compound interesthow to find simple and compound interest in javajava program to calculate interestcompound interest formula javaformula of compound interest in javacompound interest calculator javacalculate compound interest javasimple interest formula java programwrite a program to calculate the simple interest of a given amount java java program for calculating simple interestcompound interest calculator with javacompound interest formula in javacompound interest using javaprogram to calculate simple interest in javawrite a java program to calculate the simple interestprogram to calculate simple interest javacompound interest method javawrite a java program to calculate simple interestjava program to calculate simple interestjava program for compound interestwrite a program to calculate the simple interest in javacompound interest in javajava program to calculate simple interest and compound interestcompound interest javacompound interest java programjava program to calculate compound interestallintitle 3ajava program to calculate compound interestcompound interest java codejava program simple interestcalculate the simple interest in javajava program to find simple interestsimple interest program in javajava simple interest programcalculate compound interest in javahow to find compound interest in javawrite a program to find the simple interest in javajava program to calculate compound interest