Option B:
public class BankAccountSimulation {
public static void main(String[] args) {
double balance = 5000.0;
int transactions = 0;
double monthlyFee = 10.0;
double interestRate = 0.02;
for (int month = 1; month <= 12; month++) {
System.out.println("Month " + month + ":");
balance += 3000;
transactions++;
System.out.println(" + Salary added: $3000.00");
balance -= 1200;
transactions++;
System.out.println(" - Rent paid: $1200.00");
balance -= monthlyFee;
transactions++;
System.out.println(" - Monthly fee: $" + monthlyFee);
balance *= (1 + interestRate);
System.out.printf(" * Interest applied (%.0f%%): $%.2f%n", interestRate * 100, balance);
System.out.printf("End of month balance: $%.2f%n", balance);
System.out.println("----------------------------");
}
double averageMonthlySpending = (12 * (1200 + monthlyFee));
averageMonthlySpending /= 12;
int tier = transactions % 5;
System.out.println("=== YEARLY SUMMARY ===");
System.out.printf("Final Balance: $%.2f%n", balance);
System.out.println("Total Transactions: " + transactions);
System.out.printf("Average Monthly Spending: $%.2f%n", averageMonthlySpending);
System.out.println("Account Tier (based on transactions): " + tier);
}
}