CompoundValue.java completed?
This commit is contained in:
parent
05389258ab
commit
1ab026d1cd
@ -11,17 +11,27 @@ import java.util.Scanner;
|
|||||||
* @author caleb
|
* @author caleb
|
||||||
*/
|
*/
|
||||||
public class CompoundValue {
|
public class CompoundValue {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// Create Scanner
|
// Create Scanner
|
||||||
Scanner input = new Scanner(System.in);
|
Scanner input = new Scanner(System.in);
|
||||||
|
|
||||||
// Define vars
|
// Define vars
|
||||||
double SavingAmount;
|
int counter;
|
||||||
|
double SavingAmount;
|
||||||
// Prompt for input
|
double InterestRate;
|
||||||
System.out.println("");
|
|
||||||
// Compute
|
// Prompt for input
|
||||||
|
System.out.print("Enter monthly saving amount: ");
|
||||||
// Print result
|
SavingAmount = input.nextDouble();
|
||||||
|
|
||||||
|
// Compute and Print result
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user