-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise02_13.java
More file actions
36 lines (32 loc) · 1.62 KB
/
Exercise02_13.java
File metadata and controls
36 lines (32 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package Chapter2;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Scanner;
/**
*
* @author jorda
*/
public class Exercise02_13 {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.println("Enter the Monthly Deposit: ");
int monthlyDeposit = input.nextInt();
double monthlyInterest = .05/12;
double currentBalance = 0;
currentBalance = (monthlyDeposit + currentBalance) * (1 + monthlyInterest);
System.out.println("After the first month, the account value is $" + currentBalance);
currentBalance = (monthlyDeposit + currentBalance) * (1 + monthlyInterest);
System.out.println("After the second month, the account value is $" + currentBalance);
currentBalance = (monthlyDeposit + currentBalance) * (1 + monthlyInterest);
System.out.println("After the third month, the account value is $" + currentBalance);
currentBalance = (monthlyDeposit + currentBalance) * (1 + monthlyInterest);
//System.out.println("After the fourth month, the account value is $" + currentBalance);
currentBalance = (monthlyDeposit + currentBalance) * (1 + monthlyInterest);
//System.out.println("After the fifth month, the account value is $" + currentBalance);
currentBalance = (monthlyDeposit + currentBalance) * (1 + monthlyInterest);
System.out.println("After the sixth month, the account value is $" + currentBalance);
}
}