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

Create a .java file called SavingsAccount.java, and complete it, doing the follo

ID: 3798056 • Letter: C

Question

Create a .java file called SavingsAccount.java, and complete it, doing the following.


1) Create a public class called SavingsAccount
2) Include a constructor that takes as parameters the owner's name, and an initial account balance.
3) Include private non-static variables for the name of the account holder and he account balance.
4) Include private static variables for the low and high interest rates.
5) Write public getter and setter methods for the account holder name and account balance.
6) Write a public getter method for the interest rate, calculated as described above.
7) Include public static getter and setter methods for the low and high interest rates.
8) Save the file and make sure it compiles.

Explanation / Answer

public class SavingAccount {

    private String name;
    private int account_Balance;
private static int low_rate;
private static int high_rate;


public SavingAccount(String name , int account_Balance)
{
  this.name =name;
  this.account_Balance = account_Balance;
}

   

public void setName(String name) {
       this.name = name;
    }

    public String getName() {
       return name;
    }

public void setAccount_balance(int account_Balance) {
       this.account_Balance = account_Balance;
    }

    public int getAccount_balance() {
       return account_Balance;
    }


public static void setlow_rate(int low_rate1) {
       low_rate = low_rate1;
    }

    public static int getlow_rate() {
       return low_rate;
    }


public static void sethigh_rate(int high_rate1) {
       high_rate = high_rate1;
    }

    public static int gethigh_rate() {
       return high_rate;
}

    public int getinterest_rate() {
        return 1;
    }

   
}