Problem with Calculation ....
i need to calculate :
interest earned = invesment value (current) * (interest rate / 100)
invesment value (new) = invesment value (current) + interest earned
how do i write in a java program ?
is it ,
Code:
import java.util.scanner;
public class invesment
{
public static void main (String [] args)
{
double intEarned = a;
double inteValue = b;
double newInves = c;
Scanner keyboard = new Scanner(System.in);
// this where we input the value
System.out.print("Enter your Invesment Value:");
b = keyboard.nextDouble();
int i = 0;
while (i < 5 )
{
a = b * (10/100)
c = b + a
i = i + 1;
}
and so on.
my result must be like this :
year interest Earned Investment Value
---- --------------- -----------------
1 $10.00 $110.00
2 $11.00 $121.00
3 $12.10 $133.10
4 $13.31 $146.41
5 $14.64 $161.05
* how do i loop it ?
* is my calculation is correct ?
Thanks!