Created
April 6, 2017 02:52
-
-
Save RupGautam/95cdb9c528f185f5db793b395df71d01 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package Assignment4; | |
| /** | |
| * Created by RupGautam on 4/1/17. | |
| */ | |
| import java.util.ArrayList; | |
| /** | |
| * Copyright ${COPYRIGHT}. | |
| */ | |
| public class Account { | |
| private static int lastSeq; | |
| private int sequenceNumber; | |
| private String accountNumber; | |
| private int balance; | |
| private String owner; | |
| private ArrayList<Account> Account = new ArrayList<>(); | |
| public Account(String a, int b, String o) { | |
| this.accountNumber = a; | |
| this.balance = b; | |
| this.owner = o; | |
| } | |
| //Setting up getters | |
| public String getAccountNumber() { | |
| return accountNumber; | |
| } | |
| public int getBalance() { | |
| return balance; | |
| } | |
| public void setAccountNumber(String an) { | |
| accountNumber = an; | |
| } | |
| public void setBalance(int b) { | |
| balance = b; | |
| } | |
| public void setOwner(String o) { | |
| owner = o; | |
| } | |
| public String toString() { | |
| return accountNumber + "\t" + balance + "\t" + owner; | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package Assignment4; | |
| /** | |
| * Created by RupGautam on 4/1/17. | |
| */ | |
| /** | |
| * Copyright ${COPYRIGHT}. | |
| */ | |
| public class Driver { | |
| public static void main(String[] args) { | |
| Account James = new Account("901", 1000, "James"); | |
| Account Daniel = new Account("902", 1000, "Daniel"); | |
| Account Connie = new Account("903", 1000, "Connie"); | |
| Account Debbi = new Account("904", 1000, "Debbi"); | |
| Account Joseph = new Account("905", 1000, "Joseph"); | |
| System.out.println("_________________________________"); | |
| System.out.println(James); | |
| System.out.println("_________________________________"); | |
| System.out.println(Daniel); | |
| System.out.println("_________________________________"); | |
| System.out.println(Connie); | |
| System.out.println("_________________________________"); | |
| System.out.println(Debbi); | |
| System.out.println("_________________________________"); | |
| System.out.println(Joseph); | |
| System.out.println("_________________________________"); | |
| System.out.println("_____________________________________________"); | |
| System.out.println("Date" + "" + "\t\tA/C Type" + "\t\tAmount $" + "\t\tOwner"); | |
| System.out.println("_____________________________________________"); | |
| Transaction t1 = new Transaction("Jan 1, 2017", "\t\tdeposit", 1000, James); //Jame | |
| Transaction t2 = new Transaction("Jan 2, 2017", "\t\tdeposit", 1000, Daniel); //Daniel | |
| Transaction t3 = new Transaction("Jan 3, 2017", "\t\tdeposit", 3000, Connie); //Connie | |
| Transaction t4 = new Transaction("Jan 4, 2017", "\t\tdeposit", 4000, Connie); //Connie | |
| Transaction t5 = new Transaction("Jan 5, 2017", "\t\twithdrawal", 250, James); //James | |
| Transaction t6 = new Transaction("Jan 6, 2017", "\t\twithdrawal", 1500, Connie); //Connie | |
| Transaction t7 = new Transaction("Jan 7, 2017", "\t\tdeposit", 4000, Debbi); //Debbie | |
| Transaction t8 = new Transaction("Jan 8, 2017", "\t\t\tbalanceRequest", James); //James | |
| Transaction t9 = new Transaction("Jan 8, 2017", "\t\t\tbalanceRequest", Daniel); //Daniel | |
| Transaction t10 = new Transaction("Jan 8, 2017", "\t\t\tbalanceRequest", Connie); //Connie | |
| Transaction t11 = new Transaction("Jan 8, 2017", "\t\t\tbalanceRequest", Debbi); //Debbie | |
| Transaction t12 = new Transaction("Jan 8, 2017", "\t\t\tbalanceRequest", Joseph); //Joseph | |
| System.out.println(t1); | |
| System.out.println("__________________________________________________"); | |
| System.out.println(t2); | |
| System.out.println("__________________________________________________"); | |
| System.out.println(t3); | |
| System.out.println("__________________________________________________"); | |
| System.out.println(t4); | |
| System.out.println("__________________________________________________"); | |
| System.out.println(t5); | |
| System.out.println("__________________________________________________"); | |
| System.out.println(t6); | |
| System.out.println("____________________________________________________"); | |
| System.out.println(t7); | |
| System.out.println("____________________________________________________"); | |
| System.out.println(t8); | |
| System.out.println("_______________________________________________________"); | |
| System.out.println(t9); | |
| System.out.println("_______________________________________________________"); | |
| System.out.println(t10); | |
| System.out.println("_______________________________________________________"); | |
| System.out.println(t11); | |
| System.out.println("_______________________________________________________"); | |
| System.out.println(t12); | |
| System.out.println("_______________________________________________________"); | |
| t2.addTransaction(Daniel); | |
| t3.addTransaction(Connie); | |
| t4.addTransaction(Connie); | |
| t5.addTransaction(James); | |
| t6.addTransaction(Connie); | |
| t7.addTransaction(Debbi); | |
| t8.addTransaction(James); | |
| t9.addTransaction(Daniel); | |
| t10.addTransaction(Connie); | |
| t11.addTransaction(Debbi); | |
| t12.addTransaction(Joseph); | |
| //System.out.println(t1.toString()); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package Assignment4; | |
| /** | |
| * Created by RupGautam on 4/1/17. | |
| */ | |
| import java.util.ArrayList; | |
| /** | |
| * Copyright ${COPYRIGHT}. | |
| */ | |
| public class Account { | |
| private static int lastSeq; | |
| private int sequenceNumber; | |
| private String accountNumber; | |
| private int balance; | |
| private String owner; | |
| private ArrayList<Account> Account = new ArrayList<>(); | |
| public Account(String a, int b, String o) { | |
| this.accountNumber = a; | |
| this.balance = b; | |
| this.owner = o; | |
| } | |
| //Setting up getters | |
| public String getAccountNumber() { | |
| return accountNumber; | |
| } | |
| public int getBalance() { | |
| return balance; | |
| } | |
| public void setAccountNumber(String an) { | |
| accountNumber = an; | |
| } | |
| public void setBalance(int b) { | |
| balance = b; | |
| } | |
| public void setOwner(String o) { | |
| owner = o; | |
| } | |
| public String toString() { | |
| return accountNumber + "\t" + balance + "\t" + owner; | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment