/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/CompoundValue.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package com.calebfontenot.mp1_calebfontenot;
import java.util.Scanner;
@author
public class CompoundValue {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int counter;
double SavingAmount;
double InterestRate;
System.out.print("Enter monthly saving amount: ");
SavingAmount = input.nextDouble();
InterestRate = 0.05 / 12;
SavingAmount = SavingAmount * (1 + InterestRate);
System.out.println("The account is " + SavingAmount + " after month 1");
for (counter = 2; counter <= 6; counter++) {
SavingAmount = (100 + SavingAmount) * (1 + InterestRate);
System.out.println("The account is " + SavingAmount + " after month " + counter);
}
}
}