Comment or Uncomment one transaction to see the difference
public class CheckingAccountTest {
public static void main(String[] args) {
CheckingAccount c1 = new CheckingAccount(879101,3000);
c1.deposit(350);
c1.deposit(220);
c1.withdraw(100);
c1.deposit(1100);
c1.deposit(700);
c1.withdraw(350);
c1.withdraw(220);
//c1.withdraw(100);
c1.deposit(1100);
c1.deposit(700);
c1.deposit(1000);
System.out.println(c1);
System.out.println("After calling computeMonthlyFee()");
double before=c1.getBalance();
c1.computeMonthlyFee();
double after=c1.getBalance();
if(before!=after){
System.out.print(String.format("Balance before
applying the fee =$%.2f%n",before));
System.out.print(String.format("Balance after applying
the fee =$%.2f%n",after));
}
System.out.println(c1);
}
}
class BankAccount {
private int accountNumber;
private double balance;
public BankAccount(int accountNumber, double balance)
{
this.accountNumber = accountNumber;
this.balance=balance;
}
public int getAccountNumber() {return accountNumber;}
public double getBalance() {return balance;}
public void setAccountNumber(int accountNumber) {this.accountNumber = accountNumber;}
public void setBalance(double balance) {this.balance = balance;}
public void deposit(double amount) {
balance = balance + amount;
}
public void withdraw(double amount) {
if (amount <= balance)
balance = balance - amount;
}
public String toString() {
return String.format("Account
Number=%d%nBalance=$%.2f%n",accountNumber,balance);
}
}
class CheckingAccount extends BankAccount
{
private int transactionCount=0;
private static final int FREE_TRANSACTIONS = 10;
private static final double TRANSACTION_FEE = 2.0;
public CheckingAccount(int accountNumber, double balance)
{
super(accountNumber, balance);
}
public int getTransactionCount() { return transactionCount;}
public void setTransactionCount(int transactionCount) {
this.transactionCount = transactionCount;
}
public void deposit(double amount) {
super.deposit(amount);
transactionCount++;
}
public void withdraw(double amount) {
super.withdraw(amount);
transactionCount++;
}
public void computeMonthlyFee() {
if (transactionCount > FREE_TRANSACTIONS)
{
double fees = TRANSACTION_FEE * (transactionCount -
FREE_TRANSACTIONS);
withdraw(fees);
}
transactionCount = 0;
}
public String toString() {
return String.format("%sTransaction
Count=%d",super.toString(),transactionCount);
}
}
/* * To change this license header, choose License Headers in Project Properties. * To change...
Use the Java codes below (Checking Account and Checking Account Demo), and work on these problems. You have to do both of your java codes based on the two provided Java codes. Create one method for depositing and one for withdrawing. The deposit method should have one parameter to indicate the amount to be deposited. You must make sure the amount to be deposited is positive. The withdraw method should have one parameter to indicate the amount to be withdrawn...
TASK 1 Create a new class called CheckingAccount that extends BankAccount. It should contain a static constant FEE that represents the cost of clearing onecheck. Set it equal to 15 cents. Write a constructor that takes a name and an initial amount as parameters. Itshould call the constructor for the superclass. It should initializeaccountNumber to be the current value in accountNumber concatenatedwith -10 (All checking accounts at this bank are identified by the extension -10). There can be only one...
NETBEANS JAVA BANK PROGRAM (TAKE SCREENSHOTS FROM NETBEANS INCLUDING OUTPUT PLEASE) Display the accounts for the current displayed customer PLEASEEEEEEEEEE package bankexample; import java.util.UUID; public class Customer { private UUID id; private String email; private String password; private String firstName; private String lastName; public Customer(String firstName, String lastName, String email, String password) { this.id = UUID.randomUUID(); this.firstName = firstName; this.lastName = lastName; this.email = email; this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String...
If I enter a negative value the program throws an error and the withdrawal amount is added to the balance please help me find why? public abstract class BankAccount { private double balance; private int numOfDeposits; private int numOfwithdrawals; private double apr; private double serviceCharge; //Create getter and setter methods public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } public int getNumOfDeposits() { return numOfDeposits; } public void setNumOfDeposits(int numOfDeposits) { this.numOfDeposits =...
please rewrite this code as Pseudo-Code,.. basically rewrite the code but in english language , Thank you so much! public abstract class BankAccount { //declare the required class variables private double balance; private int num_deposits; private int num_withdraws; private double annualInterest; private double serviceCharges; //constructor that takes two arguments // one is to initialize the balance and other // to initialize the annual interest rate public BankAccount(double balance,...
Course,java import java.util.ArrayList; import java.util.Arrays; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author fenghui */ public class Course { private String cName; private ArrayList<Subject> cores; private ArrayList<Major> majors; private ArrayList<Subject> electives; private int cCredit; public Course(String n, int cc){ cName = n; cCredit = cc; cores = new ArrayList<Subject>(0); majors =...
IN JAVAThe code is attached below has the Account class that was designed to model a bank account. An account has the properties account number, balance, annual interest rate, and date created, and methods to deposit and withdraw funds. I need creat program using the 2 java programs.Create two subclasses for checking and savings accounts. A checking account has an overdraft limit, but a savings account cannot be overdrawn.I need to write a test program that creates objects of Account,...
Hello everybody. Below I have attached a code and we are supposed to add comments explaining what each line of code does. For each method add a precise description of its purpose, input and output. Explain the purpose of each member variable. . Some help would be greaty appreciated. (I have finished the code below with typing as my screen wasnt big enough to fit the whole code image) } public void withdrawal (double amount) { balance -=amount; }...
(JAVA NetBeans) Write programs in java Modify the textbook example textbook example: //BankAccount.java import java.text.DecimalFormat; public class BankAccount { public final DecimalFormat MONEY = new DecimalFormat( "$#,##0.00" ); private double balance; /** Default constructor * sets balance to 0.0 */ public BankAccount( ) { balance = 0.0; System.out.println( "In BankAccount default constructor" ); } /** Overloaded constructor * @param startBalance beginning balance */ public BankAccount( double startBalance ) { if ( balance >= 0.0 ) balance = startBalance; else balance...