Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

ID: 3777241 • Letter: R

Question

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.

Explanation / Answer

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();

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote