জাভাতে কম্পাউন্ড ইন্টারেস্ট গণনার প্রোগ্রাম নিচে দেওয়া হলো:
উদাহরণ
import java.io.*; public class Demo{ public static void main(String args[]){ double princ = 456000, rt = 9.75, tm = 7; double comp_int = princ *(Math.pow((1 + rt / 100), tm)); System.out.println("The compound interest for the given principle amount, rate and time is "+ comp_int); } }আউটপুট
The compound interest for the given principle amount, rate and time is 874573.9655622267
Demo ক্লাসে main ফাংশন আছে যেখানে একটি প্রিন্সিপাল মান, একটি রেট এবং একটি টাইম ইনিশিয়ালাইজ করা হয়েছে। কম্পাউন্ড ইন্টারেস্টের ফর্মুলা, প্রিন্সিপাল * ((1 + রেট/১০০) পাওয়ার টাইম) একটি ভেরিয়েবলে ইনিশিয়ালাইজ করা হয়েছে এবং আউটপুট ক্যালকুলেট করা হয়েছে। এটি কনসোলে প্রদর্শন করা হয়েছে।