| /home/chloe/ASDV-Java/MP1_ChloeFontenot/src/main/java/com/chloefontenot/mp1_chloefontenot/CompoundValue.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package com.chloefontenot.mp1_chloefontenot;
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);
}
}
}