Read in starting value in account yearly interest rate and n

Read in starting value in account, yearly interest rate and number of months

– Create method that gets yearly interest rate and calculates monthly rate

– Create a method called C alcInterest and pass the current value in account and monthly interest rate. It should return how much is in the savings account .

– Create loop that executes the number of months and calls the method each month returning the new value in the account

– When loop is done print the amount in the account

– Test it for 5 months with starting value of $100 and 12% yearly rate.

– Test it for 3 months with 0% yearly interest rate.

Solution

import java.util.*;

import java.util.Scanner;

class bank{

float roi;

float principal;

float simpleinterest;

float time;

float amount;

Scanner sc= new Scanner(System.in);

system.out.println(\"enter principal\");

float principal=sc.nextfloat();

system.out.principal(\"enter rate of interst\");

float roi=sc.nextfloat();

system.out.println(\"enter time\");

float time=sc.nextfloat();

pubic void CalcInterest{

simpleinterest=(principal*time*( ( roi ) / 100 ) ) )/100

amount=principal+simpleinterest;

system.out.println(\"amount is\",+amount);

}

}

public static void main(string [ ] args)

{

bank obj = new bank();

obj.CalcInterest();

}

Read in starting value in account, yearly interest rate and number of months – Create method that gets yearly interest rate and calculates monthly rate – Create
Read in starting value in account, yearly interest rate and number of months – Create method that gets yearly interest rate and calculates monthly rate – Create

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site