Java based Programming: Displaying Accounts and Transactions in the Banking System
Lab 1/Banking System/build.xml
Builds, tests, and runs the project Banking System.Lab 1/Banking System/build/classes/.netbeans_automatic_build
Lab 1/Banking System/build/classes/.netbeans_update_resources
Lab 1/Banking System/build/classes/banking/BankingSystem.class
package banking; public synchronized class BankingSystem { public void BankingSystem(); public static void main(String[]); }
Lab 1/Banking System/build/classes/banking/database/AccountDA.class
package banking.database; public synchronized class AccountDA { public static java.util.ArrayList accounts; public void AccountDA(); public static void add(banking.domain.Account); public static java.util.ArrayList getCustomerAccounts(int); public static void initialize(); static void <clinit>(); }
Lab 1/Banking System/build/classes/banking/database/CustomerDA.class
package banking.database; public synchronized class CustomerDA { private static java.util.ArrayList customers; public void CustomerDA(); public static void add(banking.domain.Customer); public static java.util.ArrayList getCustomers(); public static void inititialize(); static void <clinit>(); }
Lab 1/Banking System/build/classes/banking/database/TransactionDA.class
package banking.database; public synchronized class TransactionDA { private static java.util.ArrayList transactions; public void TransactionDA(); public static void add(banking.domain.Transaction); public static java.util.ArrayList getAccountTransactions(int); public static void initialize(); static void <clinit>(); }
Lab 1/Banking System/build/classes/banking/domain/Account.class
package banking.domain; public abstract synchronized class Account { private int accountNumber; private int customerID; private String accountName; private java.util.Date dateOpened; public void Account(); public void add(); public String getAccountName(); public int getAccountNumber(); public static java.util.ArrayList getCustomerAccounts(int); public int getCustomerID(); public java.util.Date getDateOpened(); public java.util.ArrayList getTransactions(); public static void initialize(); public void setAccountName(String); public void setAccountNumber(int); public void setCustomerID(int); public void setDateOpened(java.util.Date); public String toString(); }
Lab 1/Banking System/build/classes/banking/domain/Asset.class
package banking.domain; public synchronized class Asset extends Account { public void Asset(); }
Lab 1/Banking System/build/classes/banking/domain/Customer.class
package banking.domain; public synchronized class Customer { private int customerID; private String name; private long phoneNumber; public void Customer(); public void add(); public static void add(Customer); public java.util.ArrayList getAccounts(); public int getCustomerID(); public static java.util.ArrayList getCustomers(); public String getName(); public long getPhoneNumber(); public void setCustomerID(int); public void setName(String); public void setPhoneNumber(long); public static void initialize(); public String toString(); }
Lab 1/Banking System/build/classes/banking/domain/Liability.class
package banking.domain; public synchronized class Liability extends Account { public void Liability(); }
Lab 1/Banking System/build/classes/banking/domain/Transaction.class
package banking.domain; public synchronized class Transaction { private double amount; private int transactionID; private java.util.Date transactionDate; private int accountNumber; private String description; public void Transaction(); public void add(); public int getAccountNumber(); public double getAmount(); public static java.util.ArrayList getAccountTransactions(int); public String getDescription(); public java.util.Date getTransactionDate(); public int getTransactionID(); public static void initialize(); public void setAccountNumber(int); public void setAmount(double); public void setDescription(String); public void setTransactionDate(java.util.Date); public void setTransactionID(int); public String toString(); }
Lab 1/Banking System/manifest.mf
Manifest-Version: 1.0 X-COMMENT: Main-Class will be added automatically by build
Lab 1/Banking System/nbproject/build-impl.xml
Must set src.dir Must set test.src.dir Must set build.dir Must set dist.dir Must set build.classes.dir Must set dist.javadoc.dir Must set build.test.classes.dir Must set build.test.results.dir Must set build.classes.excludes Must set dist.jar Must set javac.includes No tests executed. Must set JVM to use for profiling in profiler.info.jvm Must set profiler agent JVM arguments in profiler.info.jvmargs.agentLab 1/Banking System/nbproject/genfiles.properties
build.xml.data.CRC32=db319861 build.xml.script.CRC32=538a4852 [email protected] # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=db319861 nbproject/build-impl.xml.script.CRC32=ae7b57ca nbproject/[email protected]
Lab 1/Banking System/nbproject/private/private.properties
compile.on.save=true user.properties.file=C:\\Users\\dstrong\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
Lab 1/Banking System/nbproject/private/private.xml
file:/C:/Users/dstrong/Documents/Yogi/Courses/CIS640/Projects/Labs/Banking%20System/Banking%20System/src/banking/domain/Transaction.java file:/C:/Users/dstrong/Documents/Yogi/Courses/CIS640/Projects/Labs/Banking%20System/Banking%20System/src/banking/database/TransactionDA.javaLab 1/Banking System/nbproject/project.properties
annotation.processing.enabled=true annotation.processing.enabled.in.editor=false annotation.processing.processor.options= annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: build.dir=build build.generated.dir=${build.dir}/generated build.generated.sources.dir=${build.dir}/generated-sources # Only compile against the classpath explicitly listed here: build.sysclasspath=ignore build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results # Uncomment to specify the preferred debugger connection transport: #debug.transport=dt_socket debug.classpath=\ ${run.classpath} debug.test.classpath=\ ${run.test.classpath} # Files in build.classes.dir which should be excluded from distribution jar dist.archive.excludes= # This directory is removed when the project is cleaned: dist.dir=dist dist.jar=${dist.dir}/Banking_System.jar dist.javadoc.dir=${dist.dir}/javadoc excludes= includes=** jar.compress=false javac.classpath= # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false javac.external.vm=true javac.processorpath=\ ${javac.classpath} javac.source=1.8 javac.target=1.8 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= javadoc.author=false javadoc.encoding=${source.encoding} javadoc.noindex=false javadoc.nonavbar=false javadoc.notree=false javadoc.private=false javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= main.class=banking.BankingSystem manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false platform.active=default_platform run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} # Space-separated list of JVM arguments used when running the project. # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. # To set system properties for unit tests define test-sys-prop.name=value: run.jvmargs= run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 src.dir=src test.src.dir=test
Lab 1/Banking System/nbproject/project.xml
org.netbeans.modules.java.j2seproject Banking SystemLab 1/Banking System/src/banking/BankingSystem.java
Lab 1/Banking System/src/banking/BankingSystem.java
package
banking
;
import
banking
.
domain
.
Customer
;
import
banking
.
domain
.
Account
;
import
banking
.
domain
.
Transaction
;
import
java
.
util
.
ArrayList
;
public
class
BankingSystem
{
public
static
void
main
(
String
[]
args
)
{
Customer
.
initialize
();
Account
.
initialize
();
Transaction
.
initialize
();
ArrayList
<
Customer
>
customers
=
Customer
.
getCustomers
();
for
(
int
i
=
0
;
i
<
customers
.
size
();
i
++
){
System
.
out
.
println
(
customers
.
get
(
i
));
}
}
}
Lab 1/Banking System/src/banking/database/AccountDA.java
Lab 1/Banking System/src/banking/database/AccountDA.java
package
banking
.
database
;
import
banking
.
domain
.
Account
;
import
banking
.
domain
.
Asset
;
import
banking
.
domain
.
Liability
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
Date
;
public
class
AccountDA
{
public
static
ArrayList
<
Account
>
accounts
=
new
ArrayList
<
Account
>
(
5
);
public
static
void
add
(
Account
acc
)
{
accounts
.
add
(
acc
);
}
public
static
ArrayList
<
Account
>
getCustomerAccounts
(
int
custID
)
{
Account
acc
;
ArrayList
<
Account
>
customerAccounts
=
new
ArrayList
<
Account
>
(
5
);
for
(
int
i
=
0
;
i
<
accounts
.
size
();
i
++
)
{
acc
=
accounts
.
get
(
i
);
if
(
acc
.
getCustomerID
()
==
custID
)
customerAccounts
.
add
(
acc
);
}
return
customerAccounts
;
}
public
static
void
initialize
(){
Account
a
;
Date
today
=
new
Date
();
a
=
new
Asset
();
a
.
setAccountNumber
(
10101
);
a
.
setCustomerID
(
101
);
a
.
setAccountName
(
"Customer One Checking Account"
);
a
.
setDateOpened
(
today
);
a
.
add
();
a
=
new
Asset
();
a
.
setAccountNumber
(
10102
);
a
.
setCustomerID
(
101
);
a
.
setAccountName
(
"Customer One Savings Account"
);
a
.
setDateOpened
(
today
);
a
.
add
();
a
=
new
Asset
();
a
.
setAccountNumber
(
10201
);
a
.
setCustomerID
(
102
);
a
.
setAccountName
(
"Savings Account"
);
a
.
setDateOpened
(
today
);
a
.
add
();
a
=
new
Liability
();
a
.
setAccountNumber
(
10202
);
a
.
setCustomerID
(
102
);
a
.
setAccountName
(
"Customer Two Credit Card"
);
a
.
setDateOpened
(
today
);
a
.
add
();
}
}
Lab 1/Banking System/src/banking/database/CustomerDA.java
Lab 1/Banking System/src/banking/database/CustomerDA.java
package
banking
.
database
;
import
banking
.
domain
.
Customer
;
import
java
.
util
.
ArrayList
;
public
class
CustomerDA
{
private
static
ArrayList
<
Customer
>
customers
=
new
ArrayList
<
Customer
>
(
5
);
public
static
void
add
(
Customer
c
)
{
customers
.
add
(
c
);
}
public
static
ArrayList
<
Customer
>
getCustomers
()
{
return
customers
;
}
public
static
void
inititialize
()
{
Customer
c
;
c
=
new
Customer
();
c
.
setCustomerID
(
101
);
c
.
setName
(
"Customer One"
);
c
.
setPhoneNumber
(
5551212
);
c
.
add
();
c
=
new
Customer
();
c
.
setCustomerID
(
102
);
c
.
setName
(
"Customer Two"
);
c
.
setPhoneNumber
(
4442323
);
c
.
add
();
}
}
Lab 1/Banking System/src/banking/database/TransactionDA.java
Lab 1/Banking System/src/banking/database/TransactionDA.java
package
banking
.
database
;
import
banking
.
domain
.
Transaction
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
Date
;
public
class
TransactionDA
{
private
static
ArrayList
<
Transaction
>
transactions
=
new
ArrayList
<
Transaction
>
(
5
);
public
static
void
add
(
Transaction
trans
)
{
trans
.
setTransactionID
(
transactions
.
size
()
+
1
);
transactions
.
add
(
trans
);
}
public
static
ArrayList
<
Transaction
>
getAccountTransactions
(
int
accNo
){
ArrayList
<
Transaction
>
accountTransactions
=
new
ArrayList
<
Transaction
>
(
5
);
Transaction
trans
;
for
(
int
i
=
0
;
i
<
transactions
.
size
();
i
++
)
{
trans
=
transactions
.
get
(
i
);
if
(
accNo
==
trans
.
getAccountNumber
())
accountTransactions
.
add
(
trans
);
}
return
accountTransactions
;
}
public
static
void
initialize
()
{
Transaction
t
;
Date
today
=
new
Date
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10101
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 1"
);
t
.
setAmount
(
100
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10101
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 2"
);
t
.
setAmount
(
-
21.95
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10101
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 3"
);
t
.
setAmount
(
16.25
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10102
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 1"
);
t
.
setAmount
(
50.00
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10102
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 2"
);
t
.
setAmount
(
250.00
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10102
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 3"
);
t
.
setAmount
(
-
10.00
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10202
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 1"
);
t
.
setAmount
(
500.00
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10202
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 2"
);
t
.
setAmount
(
-
50.00
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10202
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 3"
);
t
.
setAmount
(
25.00
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10201
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 1"
);
t
.
setAmount
(
49.75
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10201
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 2"
);
t
.
setAmount
(
16.25
);
t
.
add
();
t
=
new
Transaction
();
t
.
setAccountNumber
(
10201
);
t
.
setTransactionDate
(
today
);
t
.
setDescription
(
"Transaction 3"
);
t
.
setAmount
(
-
25.0
);
t
.
add
();
}
}
Lab 1/Banking System/src/banking/domain/Account.java
Lab 1/Banking System/src/banking/domain/Account.java
package
banking
.
domain
;
import
banking
.
database
.
AccountDA
;
import
java
.
util
.
Date
;
import
java
.
util
.
ArrayList
;
public
abstract
class
Account
{
private
int
accountNumber
;
private
int
customerID
;
private
String
accountName
;
private
Date
dateOpened
;
public
void
add
()
{
AccountDA
.
add
(
this
);
}
public
String
getAccountName
()
{
return
accountName
;
}
public
int
getAccountNumber
()
{
return
accountNumber
;
}
public
static
ArrayList
<
Account
>
getCustomerAccounts
(
int
custID
)
{
return
AccountDA
.
getCustomerAccounts
(
custID
);
}
public
int
getCustomerID
()
{
return
customerID
;
}
public
Date
getDateOpened
()
{
return
dateOpened
;
}
public
ArrayList
<
Transaction
>
getTransactions
()
{
return
Transaction
.
getAccountTransactions
(
accountNumber
);
}
public
static
void
initialize
()
{
AccountDA
.
initialize
();
}
public
void
setAccountName
(
String
accountName
)
{
this
.
accountName
=
accountName
;
}
public
void
setAccountNumber
(
int
accountNumber
)
{
this
.
accountNumber
=
accountNumber
;
}
public
void
setCustomerID
(
int
customerID
)
{
this
.
customerID
=
customerID
;
}
public
void
setDateOpened
(
Date
dateOpened
)
{
this
.
dateOpened
=
dateOpened
;
}
public
String
toString
()
{
ArrayList
<
Transaction
>
transactions
=
getTransactions
();
double
sum
=
0.0
;
String
returnString
=
"Account: "
+
accountNumber
+
" "
+
accountName
+
" "
+
dateOpened
;
for
(
int
i
=
0
;
i
<
transactions
.
size
();
i
++
){
sum
=
sum
+=
transactions
.
get
(
i
).
getAmount
();
returnString
=
returnString
+
"\n "
+
transactions
.
get
(
i
)
+
" "
+
sum
;
}
return
returnString
;
}
}
Lab 1/Banking System/src/banking/domain/Asset.java
Lab 1/Banking System/src/banking/domain/Asset.java
package
banking
.
domain
;
public
class
Asset
extends
Account
{
}
Lab 1/Banking System/src/banking/domain/Customer.java
Lab 1/Banking System/src/banking/domain/Customer.java
package
banking
.
domain
;
import
banking
.
database
.
CustomerDA
;
import
banking
.
domain
.
Account
;
import
java
.
util
.
ArrayList
;
public
class
Customer
{
private
int
customerID
;
private
String
name
;
private
long
phoneNumber
;
public
void
add
()
{
CustomerDA
.
add
(
this
);
}
public
static
void
add
(
Customer
c
)
{
CustomerDA
.
add
(
c
);
}
public
ArrayList
<
Account
>
getAccounts
()
{
return
Account
.
getCustomerAccounts
(
customerID
);
}
public
int
getCustomerID
()
{
return
customerID
;
}
public
static
ArrayList
<
Customer
>
getCustomers
()
{
return
CustomerDA
.
getCustomers
();
}
public
String
getName
()
{
return
name
;
}
public
long
getPhoneNumber
()
{
return
phoneNumber
;
}
public
void
setCustomerID
(
int
customerID
)
{
this
.
customerID
=
customerID
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
void
setPhoneNumber
(
long
phoneNumber
)
{
this
.
phoneNumber
=
phoneNumber
;
}
public
static
void
initialize
()
{
CustomerDA
.
inititialize
();
}
public
String
toString
()
{
String
returnString
=
"\nCustomer "
+
customerID
+
" "
+
name
;
ArrayList
<
Account
>
accounts
=
getAccounts
();
for
(
int
i
=
0
;
i
<
accounts
.
size
();
i
++
)
{
returnString
=
returnString
+
"\n "
+
accounts
.
get
(
i
);
}
return
returnString
;
}
}
Lab 1/Banking System/src/banking/domain/Liability.java
Lab 1/Banking System/src/banking/domain/Liability.java
package
banking
.
domain
;
public
class
Liability
extends
Account
{
}
Lab 1/Banking System/src/banking/domain/Transaction.java
Lab 1/Banking System/src/banking/domain/Transaction.java
package
banking
.
domain
;
import
banking
.
database
.
TransactionDA
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
Date
;
public
class
Transaction
{
private
double
amount
;
private
int
transactionID
;
private
Date
transactionDate
;
private
int
accountNumber
;
private
String
description
;
public
void
add
()
{
TransactionDA
.
add
(
this
);
}
public
int
getAccountNumber
()
{
return
accountNumber
;
}
public
double
getAmount
()
{
return
amount
;
}
public
static
ArrayList
<
Transaction
>
getAccountTransactions
(
int
accNo
)
{
return
TransactionDA
.
getAccountTransactions
(
accNo
);
}
public
String
getDescription
()
{
return
description
;
}
public
Date
getTransactionDate
()
{
return
transactionDate
;
}
public
int
getTransactionID
()
{
return
transactionID
;
}
public
static
void
initialize
()
{
TransactionDA
.
initialize
();
}
public
void
setAccountNumber
(
int
accountNumber
)
{
this
.
accountNumber
=
accountNumber
;
}
public
void
setAmount
(
double
amount
)
{
this
.
amount
=
amount
;
}
public
void
setDescription
(
String
Description
)
{
this
.
description
=
Description
;
}
public
void
setTransactionDate
(
Date
transactionDate
)
{
this
.
transactionDate
=
transactionDate
;
}
public
void
setTransactionID
(
int
transactionID
)
{
this
.
transactionID
=
transactionID
;
}
public
String
toString
()
{
return
""
+
transactionID
+
" "
+
transactionDate
+
" "
+
description
+
" "
+
amount
;
}
}