public class Transaction_Account { private Date date; private double bal; private String description; char type; private double amt; double newbal; public Transaction_Account(Date date, char type, double bal, double amt, double newbal, String description){ this.date = new Date(); this.bal=bal; this.description=description; this.type = type; this.amt = amt; this.newbal= newbal; } public java.util.Date getDate(){ return date; } public char gettype(){ return type; } public double getbal(){ return bal; } public String getdescription(){ return description; } public double getamt(){ return amt; } public double getnewbal(){ return newbal; } public void setDate(Date date){ this.date=date; } public void settype(char type){ this.type=type; } public void setbal(double bal){ this.bal=bal; } public void setdescription(String description){ this.description=description; } public void setamt(double amt){ this.amt = amt; } public void getnewbal(double newbal){ this.newbal = newbal; } @Override public String toString(){ return "\n"+new Date()+" "+ "Type "+ type + " "+ "Account Balance"+ bal +" "+"Description"+description; }
public abstract class Account{ private String acctnum; double bal; private String first_name; private String last_name; private String home_add; private String email_add; ArrayList <Transaction_Account> trans = new ArrayList <>(); public Account(String first_name, String last_name, String home_add, String email_add, double bal, String acctnum){ this.first_name = first_name; this.last_name = last_name; this.acctnum= acctnum; this.bal= bal; this.home_add=home_add; this.email_add=email_add; } //setters and getter methods //getters methods public String getfirst_name(){ return first_name; } public String getlast_name(){ return last_name; } public String gethome_add(){ return home_add; } public String getemail_add(){ return email_add; } public String getacctnum(){ return acctnum; } public double getbal(){ return bal; } public void setfirst_name(String first_name){ this.first_name = first_name; } //setters method public void setlast_name(String last_name){ this.last_name = last_name; } public void sethome_add(String home_add){ this.home_add = home_add; } public void setemail_add(String email_add){ this.email_add = email_add; } public void setacctnum(String acctnum){ this.acctnum= acctnum; } public void setbal(double bal){ this.bal=bal; } //end of getters and setters methods //toString method @Override public String toString(){ return "Customers details" + this.first_name+" "+this.last_name+" "+this.acctnum+" "+ this.home_add+" "+" "+this.email_add +" "+this.bal; } //withdraw methods public void withdraw(double total_amt){ if(total_amt < bal){ System.out.print("Your transaction has been declined because there is no funds available"+ bal); } else{ System.out.println("\n "+ "Your current balance is"+this.bal); } Transaction_Account newtrans = new Transaction_Account(new Date(), "W", this.bal, "Withdrawal made"); } }