Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a SavingsAccount class that stores a savings account\'s annual interest r

ID: 3640092 • Letter: D

Question

Design a SavingsAccount class that stores a savings account's annual interest rate and balance. The Class constructor should accept the amount of the savings account's starting balance. The class should also have methods for subtracting the amount of a withdrawal, adding the amount of a deposit, and adding the amount of the monthly interest to the balance. The monthly interest rate is the annual interest rate divided by twelve. To add the monthly interest to the balance, multiply the monthly interest rate by the balance, and add the result to the balance.

Ask user for amount deposited into account during month
Ask user for amount withdrawn from account during month
calculate monthly interest.

Explanation / Answer

import java.util.*; public class SavingAccountTest {public static void main(String[] args) {double balance,interest,withdraw,deposit; int months,i; Scanner in=new Scanner(System.in); SavingAccount account = new SavingAccount(); System.out.println("Enter the starting balance: "); balance=in.nextDouble(); account.Balance(balance); System.out.println("Enter the annual interest rate: "); interest=in.nextDouble(); account.setInterestRate(interest); System.out.println("Enter how many months the account has been open: "); months=in.nextInt(); for(i=0;i