can someone please help me create a cheachkingAccoaunt Class In the super class,
ID: 3696947 • Letter: C
Question
can someone please help me create a cheachkingAccoaunt Class
In the super class, BankAccount, add the method, transfer(), which moves money from the bank account to another account.
one account (the current object) withdraws a given amount. The other deposits the amount. How many parameters are needed in this methods?
Of course, the method needs to throw exception(s) related to withdrawal and deposit operations.
Create a subclass, CheckingAccount class, of the BankAccount class
This type of account charges transaction fees after five free transactions. Each charged transaction is charged $3.00 Be careful! Use constant and static data member as needed.
The class includes the following methods:
A default constructor
A parameterized constructor with a parameter which throws exception(s) as needed
An overridden deposit method that throws exception(s) as needed
An overridden withdrawal method that throws exception(s) as needed
A method to deduct the accumulated fees and resets the transaction count to 0
toString() method to display the account information. For numeric data should be displayed with two decimal points
here is the BankAccount Class
abstract class BankAccount implements Serializable
{
//define the data fields
private double balance;
private int dNumber;
private int withdrawals;
private double annualInterest;
private double monthlyCharges;
private double interestRate;
private double monthlyRate;
private double monthlyInterest;
public BankAccount (double myBalance, double annual)throws InvalidDepositAmount
{
balance = myBalance;
annualInterest= annual;
getdNumber ();
withdrawals = 0;
}
public BankAccount (double myBalance, double myInetrestRate, double monthlyCharge)throws InvalidDepositAmount
{
balance = myBalance;
interestRate = myInetrestRate;
monthlyCharges= monthlyCharge;
depositNumber = 0;
withdrawals = 0;
}
/** the getMonthlyCharges access the monthly charges*/
public double getMonthlyCharges()
{
return monthlyCharges;
}
{
this.monthlyCharges = monthlyCharges;
}
public int getdNumber()
{
return dNumber;
}
{
return balance;
}
/** the getDeposit method access the deposit of saving account*/
public void deposit (double myDeposit) throws InvalidDepositAmount
{
if(myDeposit <=0 || myDeposit>10000)
{
throw new InvalidDepositAmount();
}
balance += myDeposit;
depositNumber +=1;
}
public double getWithdrawals ()
{
return withdrawals;
}
public void setWithdrawal (double myAmount) throws InvalidWithdrawalAmount
{
if(myAmount <=0 || myAmount>10000){
throw new InvalidWithdrawalAmount();
}
balance = balance - myAmount;
withdrawals += 1;
}
public void calcInterest ()
{
monthlyRate = (annualInterest/12);
monthlyInterest = balance* monthlyRate;
balance = balance + monthlyInterest;
return ;
}
{
balance -= monthlyCharges;
calcInterest ();
withdrawals = 0;
depositNumber = 0;
monthlyCharges = 0;
return ;
}
public void addServiceCharge (double amount)
{
monthlyCharges += amount;
}
public void setInterestRate (double annualInterest)
{
interestRate = annualInterest;
}
public double getInterestRate ()
{
return interestRate;
}
}
Explanation / Answer
public void transfer(double my TransferAmount) throws InvalidTransferAmount
{
if(myAmount <=0 || myAmount>10000)
{
throw new InvalidTransferAmount();
}
balance = balance - myAmount;
withdrawals += 1;
}
public class CheckingAmount extends BankAccount{
private static tran_fee
public CheckingAmount() { trans_fee=$3.00;}
Super(balance, withdrawals, interstate, deposits);
public ChekcingAmount(double charges)
public void deposit (double myDeposit) throws InvalidDepositAmount
{
if(myDeposit <=0 || myDeposit>10000)
{
throw new InvalidDepositAmount();
}
balance += myDeposit;
depositNumber +=1;
}
public double getMonthlyCharges()
{
return monthlyCharges;
}
{
this.monthlyCharges = monthlyCharges;
}
public int getdNumber()
{
return dNumber;
}
public void setWithdrawal (double myAmount) throws InvalidWithdrawalAmount
{
int count=0
if(myAmount <=0 || myAmount>10000){
throw new InvalidWithdrawalAmount();
}
count++;
balance = balance - myAmount;
withdrawals += 1;
if(count>5)
trans_fee=tran_fee*3;
balance=balance-myAmount;
count=0;
}
public void display(double balance,int dNumber, int withdrawals, double annualInterest,double monthlyCharges double interestRate, double monthlyRate double monthlyInterest)
{
System.out.println(balance);
System.out.println(dnumber);
System.out.println(withdrawals);
System.out.println(annualinterest);
System.out.println(monthlyCharges);
System.out.println(interstate);
System.out.println(MonthlyRate);
System.out.println(trans_fee);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.