answersLogoWhite

0


Best Answer

public class SimpleInterest{

float principal,intRate, numOfYears;

public void setPrincipal(float principal){

this.principal = principal;

}

public void setIntRate(float intRate){

this.intRate = intRate;

} public void setNumOfYears(float numOfYears){

this.numOfYears = numOfYears;

} public float calculateSimpleInterest(){

return (this.principal * this.intRate * this.numOfYears) /100; } public static void main(String argv[]){

float principal,intRate, numOfYears;

SimpleInterest simpIntObj = new SimpleInterest();

principal = Float.parseFloat(argv[0]);

intRate = Float.parseFloat(argv[1]);

numOfYears = Float.parseFloat(argv[2]);

simpIntObj.setPrincipal(principal);

simpIntObj.setIntRate(intRate);

simpIntObj.setNumOfYears(numOfYears);

System.out.println ("Principal = "+principal);

System.out.println ("Interest Rate = "+intRate);

System.out.println ("Num of Years = "+numOfYears);

System.out.println ("Simple Interest Amount = "+simpIntObj.calculateSimpleInterest());

} }

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

float p,t,r;

float i,ci,a;

clrscr();

printf("enter the principal:\t");

scanf("%f",&p);

printf("enter the rate of interest:\t");

scanf("%f",&r);

printf("enter the time in years:\t");

scanf("%f",&t);

if((p<0)(t<0)(r<0))

printf("invalid");

else

{

i=(p*t*r)/100.0;

printf("the simple interest is rs.%.2f",i);

a=(float)p*(pow(1+r/100.0,t));

ci=a-p;

printf("the compound int is rs.%.2f",ci);

}

getch();

}

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

public doublecalculateInterest (intprinciple, int rate, int numOfYears) {

doubleinterest = (principle * rate * numOfYears)/ 100;

return interest;

}

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

double futurevalue = Principle*Math.pow (1 + interest, numberofyears);

I think maybe :)

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

ghsksjdkjdfldfklor

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Java program to find compound interest?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can you get a Java program to find the cube of a number?

Yes


Java program to find sum on even numbers from 12-45?

sum = 0; for (int i = 12; i


How do you compile and execute Java program in which we find the highest of any five numbers?

In the same way as you would compile and execute any other Java program. Compile: use the "javac" command. Or use the built-in "compile" command in your favorite IDE. Execute: Use the "java" command. Or use the built-in "run" command in your favorite IDE.


How do you find execution time of a program in java?

You can have the below line as the first and last line of the program and find out the difference in time taken to calculate the execution time. This will print the system time in the console which can be used to calculate execution time.System.currentTimeMillis();


How do you write a C program to find the Simple Interest?

Reference:cprogramming-bd.com/c_page1.aspx#simpleinterest

Related questions

Can you get a Java program to find the cube of a number?

Yes


How do you write a java program to find the ad joint of a matrix?

bgfygfrhjyuyhh


How do you write a java program for finding multiligual languages?

You can use Java's built-in functions to write a code that will find multilingual languages.


Where can someone find information on the Java language for no such method error be found?

"No such method" is an error message that may appear when attempting to create a program with Java. Users who understand the Java programming language can find an answer on websites such as Stack Overflow and Crafting Java.


Where can one find a compound interest calculator?

One can find a bunch of compound interest calculators online. Some of the sites that one can use are called, moneychimp, mathisfun and thecalculatorsite.


Jntu 2-2 oops through java answers?

write a java program to find factorial using recursive and non recursive


How do you write a java program to find the square root of a number?

You can use the Math.sqrt() method.


Find compound interest on Rs800 for 3 years at an interest 8 percent compounded semiannually for three years Find the compound inte?

800 x (1.04)6 ie Rs1012.26


How do you get memory information in Java program?

You can use the following to find out the memory usage information for a Java Program:Runtime.getRuntime().maxMemory()Runtime.getRuntime().totalMemory()Runtime.getRuntime().freeMemory()


What is the equation to find compound interest?

If the rate of annual interest is r% the period is n years and the amount invested is y Then the compound interest is y*(1+r/100)^n - y


How do you find quarterly compound interest?

it is zero i'm a bad boy


Can you create java program for me?

You can find lots of sample Java programs on the Internet. If you need something customized, you can hire programmers in sites such as ODesk, ELance, and others.