Question: In this Java Code: public class AccountHolder { double AmountinAccount; //constructor to initial the amount AccountHolder(double amount){ AmountinAccount = amount; } //method to calculate after
In this Java Code:
public class AccountHolder {
double AmountinAccount;
//constructor to initial the amount AccountHolder(double amount){ AmountinAccount = amount; }
//method to calculate after the withdraw double withdrawal(double withdrawalAmount){ //if amount is greater in account withdrawal, it would not be done if(withdrawalAmount > AmountinAccount){ System.out.println("Error! Balance should be higher than $100 "); System.exit(0); } AmountinAccount = AmountinAccount - withdrawalAmount; return(AmountinAccount);
}
//deposit method double deposit(double depositedAmount){ AmountinAccount = AmountinAccount + depositedAmount; return(AmountinAccount); }
//Interest method to display the amount of Interest void printInterest(float interestRate){ System.out.print(" Monthly balance for one year : "+ interestRate/100); System.out.print(" Balances : Account Balance with Interest. "); System.out.print(" Base :"+AmountinAccount); for(int i = 1; i <=12; i++){ AmountinAccount =AmountinAccount+ AmountinAccount *((interestRate/100)/12); System.out.printf(" Month "+ i +" :\t $%.2f",AmountinAccount); }
}
}
How can I insert the following in the code:
If a withdrawal allows the account balance to drop below $500, a one time transaction fee of $50 will be deducted from the currentaccount holders balance.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
