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

I know this is alot of writing but its mostly because i attached the given accou

ID: 3639857 • Letter: I

Question

I know this is alot of writing but its mostly because i attached the given account class. please provide source code.
Write a new class called CheckingAccount that is a subclass of Account. CheckingAccount has an annualFee data field, which is a parameter in the constructor. A negative value for annualFee should not be allowed. There is also a setter and getter for annualFee.
CheckingAccounts never have any interest; so the constructor should not have a parameter for this value. CheckingAccount overrides monthlyInterest with a method that does nothing. There is a monthlyFee method that subtracts the monthly fee from the account's balance.
Write a main program that creates a CheckingAccount; deposits some money in the account; and then calls monthlyFee.


HERES THE ACCOUNT CLASS GIVEN AND TOLD NOT TO CHANGE:
import java.util.*;

public class Account {
private String owner;
private int id;
private double balance;
private double annualInterestRate;
private Date dateCreated;
private boolean open;

/**
* Create a new Account object (with a balance of zero;
* the current Date as the Account creation Date;
* Mark the Account object as open
* @param idvalue Account id number
* @param ownerName Name of the account holder
* @param rate Annual interest rate for the account
* @throws IllegalArgumentException if idvalue is negative
* @throws IllegalArgumentException if ownerName is the empty string
* @throws IllegalArgumentException if rate is negative
*/
public Account(int idvalue, String ownerName, double rate) {
if (idvalue<0) throw new IllegalArgumentException();
if (ownerName.length()==0) throw new IllegalArgumentException();
if (rate<0.0) throw new IllegalArgumentException();
id = idvalue;
owner = ownerName;
balance = 0.0;
annualInterestRate = rate;
dateCreated = new Date();
open = true;
}
/**
* Gets the account id number
* @return the id number
*/
public int getId() {
return id;
}

/**
* Return the name of the account owner
* @return owner's name;
*/
public String getOwner() {
return owner;
}
/**
* Change the name of the account owner
* @param newName
* @throws IllegalArgumentException if newName is the empty string
*/
public void setOwner(String newName) {
if (newName.length()==0) throw new IllegalArgumentException();
this.owner = newName;
}
/**
* Gets the current balance in the account
* @return the balance
*/
public double getBalance() {
return balance;
}

/**
* Get annual interest rate
* @return the annual interest rate
*/
public double getAnnualInterestRate() {
return annualInterestRate;
}
/**
* Change the annual interest rate
* @param newAnnualInterestRate
* @throws IllegalArgumentException in the interest rate is negative
*/
public void setAnnualInterestRate(double newAnnualInterestRate) {
if (newAnnualInterestRate < 0) {
throw new IllegalArgumentException();
}
this.annualInterestRate = newAnnualInterestRate;
}
/**
* Gets the date the account was created
* @return the Date
*/
public Date getDateCreated() {
return dateCreated;
}

/**
* Withdraw the specified amount from the account
* @param amount to withdraw
* @throws IllegalArgumentException if the amount is negative or greater than the balance
*/
public void withdraw(double amount) {
if (amount < 0.0 || amount > balance) {
throw new IllegalArgumentException();
}
balance = balance - amount;
}
/**
* Deposit a specified amount into the account
* @param amount to deposit
* @throws IllegalArgumentException if the amount is negative
*/
public void deposit(double amount) {
if (amount < 0.0) {
throw new IllegalArgumentException();
}
balance = balance + amount;
}
/**
* Add monthly interest to balance
*/
public void monthlyInterest() {
balance = balance + (annualInterestRate /12 * balance);
}
/**
* Method to determine if an Account is open
* @return true if open, false otherwise
*/
public boolean isOpen() {
return open;
}
/**
* Method to mark an Account as closed (not open)
*/
public void close() {
open = false;
}
}

Explanation / Answer


public class CheckingAccount extends Account
{
private double annualFee,monthlyFee,newAnnualFee;
public CheckingAccount(annualFee)
{
if(annualFee<0) throw new IllegalArgumentException();
}
public void monthlyInterest() {
}
public void deposit(double amount) {
if (amount < 0.0) {
throw new IllegalArgumentException();
}
balance = balance + amount;
}
public void monthlyFee(double monthly fee)
{
balance=balance-monthlyFee;
}
public void setAnnualFee(double newAnnualFee) {
if (newAnnualFee<0) throw new IllegalArgumentException();
this.annualFee = newAnnualFee;
}

public void getAnnualFee()
{
return annualFee;
}


}//end of CheckingAccount class

public static void main(String args[]) throws IOException
{
private double amount=2000,p=20;
CheckingAccount obj=new CheckingAccount(10);
obj.deposit(amount);
obj.monthlyFee(p);
}