Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Exercise2_13 {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.print("Enter monthly saving amount: ");
- double monthlySavings = in.nextDouble();
- double total = 0;
- double monthlyRate = 0.00417;
- for (int i = 0; i < 6; i++) {
- total = (monthlySavings + total) * (1 + monthlyRate);
- }
- System.out.printf("After the sixth month, the account value is $%.2f", total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement