Question
need help for make up my java code. thank you! need help for java code and run completely(with comment) thanks! import java.util.Scanner; public class Driver
need help for make up my java code. thank you!
need help for java code and run completely(with comment)
thanks!
import java.util.Scanner;
public class Driver {
/**
*
*
*/
public static void main(String[] args) {
// Input from user
Scanner scan = new Scanner(System.in);
// Number of months
System.out.println("Enter the number of months:");
int numMonth = scan.nextInt();
// Periodic deposit
// Annual interest
// Perform a loop compounds the interest
// I suggest you use String.format() for the outputs
// Output monthly values
// Show compounded value
scan.close();
}
}
Your client needs a program that enables her to calculate the ending balance of a series of equal monthly deposits plus interest. Your program will prompt the user to enter the number of months over which deposits will be made, a deposit amount and an annual interest, which must be converted to monthly rate. For instance, 3% as an annual rate becomes 0.03 /12 or 0.0025 as a decimal value. We assume that deposits are made at the beginning of a month; thus each deposit will earn a full month of interest. If the user enters the following values: 12 for the number of months, $500 for the periodic deposit and 3% for the annual interest rate, the amount deposited in month 1 (I say "month 1" because this process doesn't need to follow a calendar year), will receive 12 months of interest at a monthly rate of 0.0025, then amount deposited in month 2 will receive 11 months of interest at this rate, and so on until the amount deposited in month 12 receives1 month of interest at this rate. Here's demonstration of this calculation Periodic deposit Annual interest rate Monthly interest rate 500 3.00% 0.0025 Formula for calculating ending balance: deposit (1 + monthly interest rate)Anumber of months indicates exponentiation) Number of months of Interest m restof (1 + monthly monthly interest interest rate)Anumber Deposit Deposit Accrued of months Month1 Month 2 Month 3 Month 4 Month 5 Month 6 Month 7 Month 8 Month 9 Month 10 Month 11 Month 12 500 1.0025 1.030416 1.0025 1.027846 1.0025 1.025283 1.00251.022726 1.00251.020176 1.0025 1.017632 1.0025 1.015094 1.0025 1.012563 1.00251.010038 1.0025 1.007519 1.0025 1.005006 1.0025 1.002500 515.2080 513.9230 512.6415 511.3630 510.0880 508.8160 507.5470 506.2815 505.0190 503.7595 502.5030 501.2500 500 10 8 500 500 500 500 500 500 Sum of deposits 6000 End-of-Year tota 6098.4 Even if you're mathematically clever enough to derive a formula that can perform this calculation in one statement, use a loop to solve this problem Your program should display a table like the one above plus the sum of deposits and the end-of-year totalStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started