Please I just need to organize it as it requaired below, I got into accident and
ID: 3676446 • Letter: P
Question
Please I just need to organize it as it requaired below, I got into accident and I need to finish this soon, Help
You can find the links and all the requaired files down here
ex 11 http://goo.gl/9lzGLV
ex 12 http://goo.gl/qzh0Sd
ex 13 http://goo.gl/o6kiXl
Chapter 8: Exercises #11, #12, and #13, page 568 30 points
You are to incorporate all requirements of the three exercises into the basic class definition provided in the Exercise #11 description. In addition, you must check the values of deposit, withdrawal, and transfer amounts to ensure they are greater than 0. For two of the three methods, deposit and withdraw, the methods are to return a boolean value to indicate if the transaction was completed. For method transfer, the method is to RETurn the allowed amount transferred, refer to Exercise #13 for details for a partial transfer. In addition to the specified class methods, provide a method name() that returns a String reference to the object’s account name.
To start this project, create an Eclipse project and copy the two supplied source code files, Project9_BankAccount.java and BankAccount.java into the project’s src folder. File BankAccount.java has the class definition shown in the text as your starting point; note that methods deposit and withdraw are incomplete! You must define all required methods in this file. You should not modify the Project9_BankAccount.java file as it provides a means to test your code. I will utilize this same test program to verify the functionality of the BankAccount class source code file you submit. Your code must work as shown with my “test” program! A sample Console output from this program is shown below. Code method toString() to produce the output shown for the class objects in the following Sample Console Output.
You can see the output simple from here
https://www.dropbox.com/s/skdz5bru5o7v76r/CS%20210-Project%20%239.pdf?dl=0
BankAccount.java file
https://www.dropbox.com/s/2c226pmdjcar3fx/BankAccount.java.txt?dl=0
Project9_BankAccount.java
https://www.dropbox.com/s/7dblciez2mwsehr/Project9_BankAccount.java.txt?dl=0
Explanation / Answer
*/
import java.util.ArrayList;
public class BankAccount
{
private static double INT_RATE = 10.0;
//This is used to Storee Account Number
private int accountNo;
// This is used to Store Account Holder's Name
private String accountName;
// This is used to stores balance of the account
private double balance;
// Store OverDraft Limit
private double overdraftLimit;
// This is used to store the date that the account was opened on
private Date opened;
// Store a list of Transactions
private ArrayList transactions;
// ******* MEMBER METHODS *******
//constructor
public BankAccount()
{
accountNo = 0;
accountName = "Empty";
balance = 0.0;
overdraftLimit = 0;
opened = new Date();
transactions = new ArrayList();
transactions.add(new Trans(Trans.TRANSTYPE[4],0.0,0.0));
}
// This is called COPY CONSTRUCTOR
public BankAccount(BankAccount p)
{
accountNo = p.accNo;
accountName = p.accName;
balance = p.balance;
overdraftLimit = p.odLimit;
opened = new Date(p.opened);
transactions = new ArrayList(p.transactions);
}
/
// CONSTRUCTOR with 3 arguments
public BankAccount(int no1, String namehere, double bal1)
{
accountNo = no1;
accountName = namehere;
balance = bal1;
overdraftLimit = 0;
opened = new Date();
transactions = new ArrayList();
transactions.add(new Trans(Trans.TRANSTYPE[4],bal1,bal1));
}
// we have created a clone method here
public Object clone()
{
BankAccount z = new BankAccount();
z.accountNo = accountNo;
z.acccountName = accountName;
z.balance = balance;
z.overdraftLimit = overdraftLimit;
z.opened = new Date(opened);
z.transactions = new ArrayList(transactions);
return z;
}
// This is done to compare the onject passed with equals method
public boolean equals(Object other)
{
return accountNo == ((BankAccount)other).accountNo;
}
// toString() method - ALWAYS takes the form public String toString()
// Returns a string representation of the object
public String toString()
{
return accountNo+": "+accountName+": "+balance;
}
// These are the various accessor functions:
public void setAccountName(String name)
{
accountName = name;
}
public void setOverdraftLimit(double newLimit)
{
overdraftLimit = newLimit;
}
public double getBalance()
{
return balance;
}
public String getAccountName()
{
return accountName;
}
public int getAccountNo()
{
return accountNo;
}
// STATIC METHODS are declared once and used between all Objects
// created from this class file.
public static void setINT_RATE(double newIR)
{
INT_RATE = newIR;
}
public static double getINT_RATE()
{
return INT_RATE;
}
// UTILITY METHODS
// To deposit amount into bank->PRECONDITION amount must be positive
public void deposit(double amount)
{
balance = balance + amount;
transactions.add(new Trans(Trans.TRANSTYPE[0],amount,balance));
}
//Tow ithdraw money from bank-> Withdraw with error checking
public boolean withdraw(double amount)
{
boolean valid = false;
if (checkWithdraw(amount))
{
balance = balance - amount;
valid = true;
transactions.add(new Trans(Trans.TRANSTYPE[1],-amount,balance));
}
return valid;
}
// Adds interest to the account
public void addInterest()
{
double interest = 0;
interest = balance*(INT_RATE/100);
deposit(interest);
}
// This method is used to check whether the user has sufficient funds
// to be able to withdraw the amount specified
private boolean checkWithdraw(double amount)
{
boolean valid = true;
if((balance-amount) < odLimit)
{
valid = false;
}
return valid;
}
// method to create a String representation of all the
// transactions on the account.
public String createfinalStatement()
{
// create a temporary string to hold the whole statement
String state = "";
// create a reference (pointer) to a Trans object
// called temp
Trans temp;
// loop through all transaction objects in our specific
// BankAccount object.
for(int i=0; i < transactions.size(); i++)
{
temp = (Trans)transactions.get(i);
state = state+" "+temp.toString();
}
return state;
}
// This is the main method for testing
class bankaccount{
public static void main (String [] args)
{
// This basically used create a new BankAccount object called s1
BankAccount s1 = new BankAccount(10, rohan", 500);
// This is used to checkwhether it was created correctly
System.out.println(s1);
// display a blank lines
System.out.println();
// This is done to perform some transactions on the account
s1.deposit(700);
s1.withdraw(202);
s1withdraw(200);
s1.addInterest();
s1.withdraw(100);
// This is to display a statement to the screen
System.out.println(sg.createfinalStatement());
}
}