From 3d09896a18dc271d0d97a0827e5f329d46c0238f Mon Sep 17 00:00:00 2001 From: Ryan Gross Date: Wed, 18 Jan 2017 19:35:50 -0500 Subject: [PATCH 1/4] Added Rotating Array Lab --- pom.xml | 17 ++++++++++++ src/main/java/gross/ryan/RotateArray.java | 34 +++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/gross/ryan/RotateArray.java diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..a2e27f4 --- /dev/null +++ b/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + gross.ryan + RotateArray + 1.0-SNAPSHOT + + + junit + junit + 4.12 + + + \ No newline at end of file diff --git a/src/main/java/gross/ryan/RotateArray.java b/src/main/java/gross/ryan/RotateArray.java new file mode 100644 index 0000000..5694cc6 --- /dev/null +++ b/src/main/java/gross/ryan/RotateArray.java @@ -0,0 +1,34 @@ +package gross.ryan; + + +import java.util.ArrayList; + +/** + * Created by ryangross on 1/18/17. + */ +public class RotateArray extends ArrayList { + + public void setUp() { + for(int i = 1; i <= 6; i++) { + this.add(i); + } + } + + public void rotate(int places) { + int counter = 0; + while (counter != places) { + this.add(this.get(0)); + this.remove((this.get(0))); + counter++; + } + } + + public static void main(String[] args) { + RotateArray example = new RotateArray(); + example.setUp(); + System.out.println(example); + example.rotate(2); + System.out.println(example); + } + +} From 03a6877c0eb65a82b05498f834f6219dfd29fac4 Mon Sep 17 00:00:00 2001 From: Ryan Gross Date: Wed, 18 Jan 2017 20:14:17 -0500 Subject: [PATCH 2/4] Added Lab #2: Humans & Superhumans --- .DS_Store | Bin 0 -> 6148 bytes Lab1/.DS_Store | Bin 0 -> 8196 bytes Lab1/RotatingArray/.DS_Store | Bin 0 -> 6148 bytes Lab1/RotatingArray/classes/.DS_Store | Bin 0 -> 6148 bytes Lab1/RotatingArray/classes/gross/.DS_Store | Bin 0 -> 6148 bytes .../RotatingArray/generated-sources/.DS_Store | Bin 0 -> 6148 bytes pom.xml => Lab1/pom.xml | 0 .../main/java/gross/ryan/RotateArray.java | 0 Lab2/pom.xml | 18 ++++++ Lab2/src/main/java/gross/ryan/Human.java | 60 ++++++++++++++++++ Lab2/src/main/java/gross/ryan/Main.java | 17 +++++ Lab2/src/main/java/gross/ryan/Superhuman.java | 47 ++++++++++++++ 12 files changed, 142 insertions(+) create mode 100644 .DS_Store create mode 100644 Lab1/.DS_Store create mode 100644 Lab1/RotatingArray/.DS_Store create mode 100644 Lab1/RotatingArray/classes/.DS_Store create mode 100644 Lab1/RotatingArray/classes/gross/.DS_Store create mode 100644 Lab1/RotatingArray/generated-sources/.DS_Store rename pom.xml => Lab1/pom.xml (100%) rename {src => Lab1/src}/main/java/gross/ryan/RotateArray.java (100%) create mode 100644 Lab2/pom.xml create mode 100644 Lab2/src/main/java/gross/ryan/Human.java create mode 100644 Lab2/src/main/java/gross/ryan/Main.java create mode 100644 Lab2/src/main/java/gross/ryan/Superhuman.java diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3fdba532b42d5e612da8634d79599d8269cc902b GIT binary patch literal 6148 zcmeHK!AiqG5Z!H~rij>sV2^w8)XH<+2a)3(ZW<5W zAabGqz7$Q4zsLZ7JA<7uhqW`<;pORUYY9`3YV*cU&wIAErrw) z1H`~014Y#>WBot*{{6q0L_K1F82DEVaHHL6+pr~FTbDM6wN`-kKv6I*S2#-nLzZHQ e#Zp`Wl>&Z&2B4)eR|p;ux(G-bs38V^m4Q!V$WPM% literal 0 HcmV?d00001 diff --git a/Lab1/.DS_Store b/Lab1/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ae70febab21416735246c2b793901ffe6ae9f691 GIT binary patch literal 8196 zcmeHMU2GIp6h7ZlV1@~Fiq#hFgoRT1Nrh5=3Xz}fma65imA16}mf790oj9GTJF_jN z6l>y>sPRbyYKZ#c-=kpk$>@tj6C+lQgcoCi`k*nGD2Xxg+_|$2Ewu5;5Sg3Yd+wcc z&OP^>{m$GyyF`R^A-9&Ol86-Ug6bL%w`hVd`b{knJt<)d)+Y+cCYO4tk@7c5#}DEN z#1V)i5Jw=6KpcVFAp(47i>6F-?@Mkx#u11ka7RW!ydRR>1x-bCOw#bx!9!RAFcl?0 z*m%x$K&X?9Xey#(l7_0hr>q_jsUj*dAk~?l6yi)%5gn6MsuQF-A+n69LP2Pq^^&1D zAth-%#u11kaB~Di`pl<& zs){;aInv(e4YdbmQ1H`c{!qBGb5qa=GrR2ggH6)q#CXx=%M&io)3o`<&Rx6r>}~DQ^@4Bhvm7(9 z2dy1uVEH|Isn5}9$$D;E-Wp_IyRx2B=y#b@mNlJhfrYI`$7#1uNa<|ebDTEMw*%XA z4|E6C@j&pzMw3|G2YoLeG=-aW+q}P&S}1I^4hUs`zm@lys_HunDi$wW@j!jUmQ?e2 zsb045u5wK~$e)QD*pJy(zH`XV1$_rhKWn);+wJWdw0%3{SRJm}Z zv<{zr)y+t7^%_m4&@GPFg^LPp8@ETsn8+aGzaRKk+ zBYc4`aS31H3a;Wu{Dhxz4Syv{5^7?hJZGYa{x-QTj)`)f&5-bn{wU!SFW(ydRS!SX zvU6ASZHxZz7D&k7eNRQQX4RVYo42JWpfLpxH=;6xqQqK=!6L@OkAD)d$7OD4i;H

2J)&JX9cw z68OkQIaL^AA0}SU8oWvHq)$ literal 0 HcmV?d00001 diff --git a/Lab1/RotatingArray/.DS_Store b/Lab1/RotatingArray/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d8e73eeffddd24c007c59de2cec252553cd629f8 GIT binary patch literal 6148 zcmeHK%}N6?5T4koTScrO*kdly*-K|AyWnV+z$S3f1 z{PNSHR>6y6B~vEfWRgibA0*i!B3ADNt3*X2a-b6PGiW{$IWBcXCX6Q!WNM9sT9o+R z{_hUKy?-CG!Rc z@C4&Snm3Jh9Etb>BQk1%E|7c-ZG(yw7|;p`5!8X_{67=(jnqGoHK5hvI5S`li!(dU zN!b5x8L$le2m|td;82OK!AzsNI?$*R04P5rl)#p?gpA<^U4xlMj6j$U1?o^{N(`pM z;pb+aYcSKO!-<*VgPEO~sZf~O9qV&7otUf9ww3|Qzga$5ua7uhKtur> z-x7$zpldMG2qPd|rvmC!Zk`xir-NUZIM-mNQKvJmR)%@Z%G|tAxLO_jLWMK#YNVDJ zAO@Bh$m_0y_5bwy_y2Md^@sst;9oJo3$1pm30pF?b!Br{YXxWr6b0iljq?;RR4Im7 eEX5^ICEyom0J;V`U0$WsGrm6jT|r8Dl0WV!?vu3&C;J6)9*BBF8!W@v!el zi4Xnvm1uJOMF#NO8En8N%wzH5_w)NvI7};*4_+u58=G6EWtrBFdDrSC<5udWqoL~! zZe%YEy1uqAlO&qko_`f~$8CG>G>KC$jJtz{@Z0M!4wA8(jN)J@=eh9G9^}e}+IA_+ zYV~?q)Ec#ES!9hyr7VsPkEc`9+&`$EoOd23PucVIX1E1m|P{#lO literal 0 HcmV?d00001 diff --git a/Lab1/RotatingArray/generated-sources/.DS_Store b/Lab1/RotatingArray/generated-sources/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7ddce43e900bf530d3d29fcc4997f9a54419c466 GIT binary patch literal 6148 zcmeHK!A=4(5N!c<2{Cdokz+63H~@;AOg4xIZzgN>paymWkxkYuVHb(6YxXzvkNg6E z$CKZ z#zV+e3w6ttBxy98RncfQ(yB;Wty)za9vr2qW$o?PkI#Ddk59>S`tqtd=J0n^vSV-t zZ(yw0?t?Q90~y{y#4LN3MMw+~1H{0ZF<`DatF&hOqU{g^#K7+v!23afBH9Ksjq2)v z20tHhynu)THohegg+be3rV&O!xK0JssoXpVZ2 z_=O5*+}21fF+dC~GLYBZGS>go)$jksB + + 4.0.0 + + gross.ryan + HumansAndSuperhumans + 1.0-SNAPSHOT + + + + junit + junit + 4.12 + + + \ No newline at end of file diff --git a/Lab2/src/main/java/gross/ryan/Human.java b/Lab2/src/main/java/gross/ryan/Human.java new file mode 100644 index 0000000..9ac0139 --- /dev/null +++ b/Lab2/src/main/java/gross/ryan/Human.java @@ -0,0 +1,60 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class Human { + private String name; + private int age; + private String gender; + private String occupation; + private String address; + + public Human(String aName, int anAge, String aGender, String aJob, String anAddress) { + this.name = aName; + this.age = anAge; + this.gender = aGender; + this.occupation = aJob; + this.address = anAddress; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public String getOccupation() { + return occupation; + } + + public void setOccupation(String occupation) { + this.occupation = occupation; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} diff --git a/Lab2/src/main/java/gross/ryan/Main.java b/Lab2/src/main/java/gross/ryan/Main.java new file mode 100644 index 0000000..72a6623 --- /dev/null +++ b/Lab2/src/main/java/gross/ryan/Main.java @@ -0,0 +1,17 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class Main { + + public static void main(String[] args) { + Human ryan = new Human("Ryan Gross", 23, "Male", "Boss Software Dev.", "Newark, DE"); + Superhuman kirby = new Superhuman("Ryan Gross", 23, "Male", "Boss Software Dev.", + "Newark, DE", "Kirby", false, "Nintendo SuperStar <3"); + System.out.println(kirby.getName()); + System.out.println(kirby.getSupername()); + System.out.println(kirby.isBad()); + + } +} diff --git a/Lab2/src/main/java/gross/ryan/Superhuman.java b/Lab2/src/main/java/gross/ryan/Superhuman.java new file mode 100644 index 0000000..dc92042 --- /dev/null +++ b/Lab2/src/main/java/gross/ryan/Superhuman.java @@ -0,0 +1,47 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class Superhuman extends Human { + String supername; + boolean isBad; + String superPower; + + + public String getSupername() { + return supername; + } + + public void setSupername(String supername) { + this.supername = supername; + } + + public String isBad() { + if (isBad) { + return "Bad guy"; + } return "Good guy"; + } + + public void setBad(boolean bad) { + isBad = bad; + } + + public String getSuperPower() { + return superPower; + } + + public void setSuperPower(String superPower) { + this.superPower = superPower; + } + + public Superhuman(String name, int age, String gender, String occupation, String address, + String superName, boolean isBadOrGood, String superpower) { + super(name, age, gender, occupation, address); + supername = superName; + isBad = isBadOrGood; + superPower = superpower; + } + + +} From 29d8f3e0725502aa82ee04ed2b211863b72a4ba3 Mon Sep 17 00:00:00 2001 From: Ryan Gross Date: Wed, 18 Jan 2017 21:42:26 -0500 Subject: [PATCH 3/4] Added Product Inventory Lab w/ UML --- .DS_Store | Bin 6148 -> 6148 bytes Lab3/ProductInventory.xml | 2 + Lab3/pom.xml | 18 +++++++ Lab3/src/main/java/gross/ryan/Inventory.java | 41 +++++++++++++++ Lab3/src/main/java/gross/ryan/Main.java | 17 +++++++ Lab3/src/main/java/gross/ryan/Product.java | 48 ++++++++++++++++++ .../test/java/gross/ryan/InventoryTest.java | 34 +++++++++++++ .../src/test/java/gross/ryan/ProductTest.java | 20 ++++++++ 8 files changed, 180 insertions(+) create mode 100644 Lab3/ProductInventory.xml create mode 100644 Lab3/pom.xml create mode 100644 Lab3/src/main/java/gross/ryan/Inventory.java create mode 100644 Lab3/src/main/java/gross/ryan/Main.java create mode 100644 Lab3/src/main/java/gross/ryan/Product.java create mode 100644 Lab3/src/test/java/gross/ryan/InventoryTest.java create mode 100644 Lab3/src/test/java/gross/ryan/ProductTest.java diff --git a/.DS_Store b/.DS_Store index 3fdba532b42d5e612da8634d79599d8269cc902b..c93a347734d4981823cb7923a6655516c077ae87 100644 GIT binary patch delta 21 ccmZoMXffEZoQcEG&{#*o(8O}{dZtiO07st&7XSbN delta 21 ccmZoMXffEZoQcE8)Ko{o$lPf2dZtiO07vBp8vp +7Vhtb9owEP41SPQDU14IhY8F2rVSp7ExbZ9NYhKrTo455m2/fufYDoQENd2K+oUKqfb5fLHvnnvyQMefpLvPgqySLxBR3vGcaNfxpx3Pcx3fwX/KsteW/mioDbFgkXE6GObsD7U7jXXNIppXHCUAl2xVNYaQZTSUFRsRArZVtyXw6lNXJKY1wzwkvG79xSKZaOswcA72R8rixD7ZdczKgoQvsYB1Zp7X8fxl8aeXU2JjGf88IRFsj0z+fcefCACpR+luQrnKrU2b3vdwZrU8t6CZbLPh9paOyCIYjkjfGdDBomcibAhfm1zMBERrzLE+r9zbHOVblnKS4WycyJSj0cXhEjI5N05qTjiLMxyHeCAq0LChQjLM9J1ZkLBCa5gwHj2TPazVsXOJabSzcQKC/cGwxD4Dl4U0oPEGFY+52olmB62C5ugzs7lwS9MzyaXxCYFzssrZojxwSkTMsjFICalxsjd9YJxPgIMoEmALa+6sj+NiBccmhXhRujtbF7esNnYRhZRKsUeXsoUMQGwDmen2gEbv1tiSIyQiSE0XmA6Iy9AHFODAAKElKLwaKHrqNoKFOL1TfQ5rlUFvwFXBIrbBYayGPRO27oSHOPI7s/U3JHovw7R5A5IqrGSLfHW05TTQCUyxBrIK0VwKeKG2kBkUEF4e1daYLHQ5XcqzwM1XJGRZ/Fz4TPsHy3dTFGXaJkzSOdrVmbZImWgDjLfkRe8nLIpopuAJkkiisaiAtwK8d1HIYIwfrPfE+RR0ArzXBOfuYY4f5S7kBDK8H2EFzCgCfUtz2RaTzWxQB6kBJfZeK1AO+hfApF/DZK30nJ2yky69pXT3n+qeYrXUE2yhfygcTHtuDQx+HQx+Q5E5WVA+g5xJBiq+0L4nxf+I+o5aks4lKKffUF68pGPeRl1LJhjZmUuBOdZjTMyNpgydKfTF2tbZRUeLqZwpFuveVClqotfUG6stXZUBv319tOEK1vqfWE/TV0ItxCsMKhFt/KfKYndqLoctUsmX5tmb9iR9ZdyPYlwro1/rSNcK8HftyaDWk0/ZBq8CKm4NfduWcLnqyAvqyMB7XUcOmnRk/xKkPjijIwtKf2Yqm4qD7oQg+2JqJV+Bo/KLiDFe2efd2Sd4s95rAs9F9N7tVe9dur5Neq+pvpeghmEjNRT6rGQHq4WO+KGuiBpllH1NaSFU7n+D5qmYfHX7KGrSonmjFt0AXvxt6i9MaPjyJGna1RKNRSaWVbtXLfaxbNikxZq6xQ3ersVwevgNsFg7+qHVv/8L \ No newline at end of file diff --git a/Lab3/pom.xml b/Lab3/pom.xml new file mode 100644 index 0000000..552c51b --- /dev/null +++ b/Lab3/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + gross.ryan + ProductInventoryManager + 1.0-SNAPSHOT + + + + junit + junit + 4.12 + + + \ No newline at end of file diff --git a/Lab3/src/main/java/gross/ryan/Inventory.java b/Lab3/src/main/java/gross/ryan/Inventory.java new file mode 100644 index 0000000..33ac577 --- /dev/null +++ b/Lab3/src/main/java/gross/ryan/Inventory.java @@ -0,0 +1,41 @@ +package gross.ryan; + +import org.junit.Test; + +import java.util.ArrayList; + +/** + * Created by ryangross on 1/18/17. + */ +public class Inventory { + private ArrayList anInventory = new ArrayList(); + + public ArrayList getInventory() { + return anInventory; + } + + public void addProduct(Product newProduct) { + this.getInventory().add(newProduct); + } + + public double totalInventoryValue() { + double total = 0.0; + for(int i = 0; i < this.getInventory().size(); i++) { + total += this.getInventory().get(i).totalValue(); + } + return total; + } + +// Checks quantity on hand. If zero, still shows it so you can replenish. + public String checkItem(int anID) { + String answer = "Item not found"; + for(int i = 0; i < this.getInventory().size(); i++) { + if (this.getInventory().get(i).getID() == anID) { + answer = "Item #" + this.getInventory().get(i).getID() + ": " + this.getInventory().get(i).getQOH() + + " units on hand."; + } + } + return answer; + } + +} diff --git a/Lab3/src/main/java/gross/ryan/Main.java b/Lab3/src/main/java/gross/ryan/Main.java new file mode 100644 index 0000000..2393f7f --- /dev/null +++ b/Lab3/src/main/java/gross/ryan/Main.java @@ -0,0 +1,17 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class Main { + + public static void main(String[] args) { + Inventory bestBuyInventory = new Inventory(); + Product xboxOneSlim = new Product(249.99, 5613802, 250); + Product nintendoSwitch = new Product(299.99, 567003, 20); + bestBuyInventory.addProduct(xboxOneSlim); + bestBuyInventory.addProduct(nintendoSwitch); + System.out.println(bestBuyInventory.totalInventoryValue()); + System.out.println(bestBuyInventory.checkItem(567003)); + } +} diff --git a/Lab3/src/main/java/gross/ryan/Product.java b/Lab3/src/main/java/gross/ryan/Product.java new file mode 100644 index 0000000..167263c --- /dev/null +++ b/Lab3/src/main/java/gross/ryan/Product.java @@ -0,0 +1,48 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class Product { + private double price; + private int id; + private int qoh; + + + + + public Product(double aPrice, int anID, int aQOH) { + this.price = aPrice; + this.id = anID; + this.qoh = aQOH; + } + + public double getPrice() { + return price; + } + + public int getQOH() { + return qoh; + } + + public void setPrice(double price) { + this.price = price; + } + + public void setID(int id) { + this.id = id; + } + + public int getID() { + return this.id; + } + + public void setQOH(int qoh) { + this.qoh = qoh; + } + + public double totalValue() { + return this.getPrice() * this.getQOH(); + } + +} diff --git a/Lab3/src/test/java/gross/ryan/InventoryTest.java b/Lab3/src/test/java/gross/ryan/InventoryTest.java new file mode 100644 index 0000000..e03fcb7 --- /dev/null +++ b/Lab3/src/test/java/gross/ryan/InventoryTest.java @@ -0,0 +1,34 @@ +package gross.ryan; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Created by ryangross on 1/18/17. + */ +public class InventoryTest { + Inventory bestBuyInventory; + Product xboxOneSlim = new Product(249.99, 5613802, 250); + Product nintendoSwitch = new Product(299.99, 567003, 20); + Product notAvailable = new Product(0.0,567001, 0); + + @Before + public void setUp() { + bestBuyInventory = new Inventory(); + bestBuyInventory.addProduct(xboxOneSlim); + bestBuyInventory.addProduct(nintendoSwitch); + + } + + @Test + public void totalInventoryValueTest() { + Assert.assertEquals(68497.00, bestBuyInventory.totalInventoryValue(), 1.00); + } + + @Test + public void checkItemTest() { + Assert.assertEquals("Item not found", bestBuyInventory.checkItem(567001)); + Assert.assertEquals("Item #567003: 20 units on hand.", bestBuyInventory.checkItem(567003)); + } +} diff --git a/Lab3/src/test/java/gross/ryan/ProductTest.java b/Lab3/src/test/java/gross/ryan/ProductTest.java new file mode 100644 index 0000000..3a0c6dd --- /dev/null +++ b/Lab3/src/test/java/gross/ryan/ProductTest.java @@ -0,0 +1,20 @@ +package gross.ryan; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Created by ryangross on 1/18/17. + */ +public class ProductTest { + Product xboxOneSlim = new Product(249.99, 5613802, 250); + Product nintendoSwitch = new Product(299.99, 567003, 20); + + @Test + public void totalInventoryValueTest() { + Assert.assertEquals(62498.00, xboxOneSlim.totalValue(), 1.00); + Assert.assertEquals(6000.00, nintendoSwitch.totalValue(), 1.00); + } + +} From 7ad66836c65b3034bba69f4bf7340d954539b995 Mon Sep 17 00:00:00 2001 From: Ryan Gross Date: Thu, 19 Jan 2017 00:51:07 -0500 Subject: [PATCH 4/4] Lab #4, UML is fairly current, but Unit Testing is pending. Will update 1/19/17 --- Lab3/src/main/java/gross/ryan/Main.java | 1 + Lab4/BankAccountManager.xml | 2 + Lab4/pom.xml | 31 +++++++++++ Lab4/src/main/java/gross/ryan/ATM.java | 35 +++++++++++++ Lab4/src/main/java/gross/ryan/Account.java | 49 ++++++++++++++++++ .../main/java/gross/ryan/CheckingAccount.java | 51 +++++++++++++++++++ .../java/gross/ryan/InvestmentAccount.java | 50 ++++++++++++++++++ Lab4/src/main/java/gross/ryan/Main.java | 20 ++++++++ .../main/java/gross/ryan/SavingsAccount.java | 51 +++++++++++++++++++ .../src/test/java/gross/ryan/AccountTest.java | 7 +++ .../java/gross/ryan/CheckingAccountTest.java | 7 +++ .../gross/ryan/InvestmentAccountTest.java | 7 +++ .../java/gross/ryan/SavingsAccountTest.java | 7 +++ 13 files changed, 318 insertions(+) create mode 100644 Lab4/BankAccountManager.xml create mode 100644 Lab4/pom.xml create mode 100644 Lab4/src/main/java/gross/ryan/ATM.java create mode 100644 Lab4/src/main/java/gross/ryan/Account.java create mode 100644 Lab4/src/main/java/gross/ryan/CheckingAccount.java create mode 100644 Lab4/src/main/java/gross/ryan/InvestmentAccount.java create mode 100644 Lab4/src/main/java/gross/ryan/Main.java create mode 100644 Lab4/src/main/java/gross/ryan/SavingsAccount.java create mode 100644 Lab4/src/test/java/gross/ryan/AccountTest.java create mode 100644 Lab4/src/test/java/gross/ryan/CheckingAccountTest.java create mode 100644 Lab4/src/test/java/gross/ryan/InvestmentAccountTest.java create mode 100644 Lab4/src/test/java/gross/ryan/SavingsAccountTest.java diff --git a/Lab3/src/main/java/gross/ryan/Main.java b/Lab3/src/main/java/gross/ryan/Main.java index 2393f7f..89a4a02 100644 --- a/Lab3/src/main/java/gross/ryan/Main.java +++ b/Lab3/src/main/java/gross/ryan/Main.java @@ -14,4 +14,5 @@ public static void main(String[] args) { System.out.println(bestBuyInventory.totalInventoryValue()); System.out.println(bestBuyInventory.checkItem(567003)); } + } diff --git a/Lab4/BankAccountManager.xml b/Lab4/BankAccountManager.xml new file mode 100644 index 0000000..9ce6d88 --- /dev/null +++ b/Lab4/BankAccountManager.xml @@ -0,0 +1,2 @@ + +7Vpdb9owFP01SNtDp8QhUB4hbbdJ3YdGpT07iUmsOnHkGCj79btObALEdKxagEmpkOqcXNux77mHA2bgBdnLR4GL9AuPCRsgJ34ZeHcDhFzHc+CfQjY1MvSHNZAIGuugBpjTX8T01OiSxqTcC5ScM0mLfTDieU4iuYdhIfh6P2zB2f6sBU5IC5hHmLXRnzSWaY3e+k6DfyI0Sc3MrqPvhDh6TgRf5nq+AfIW1V99O8NmLB1fpjjm6x3Iux94geBc1q3sJSBM7a3Ztrrfw5G72+cWJJendEDh0HPHYy/2EfIcL7zRI6wwW+q9mEYRrAdGmwI+DUspMOx4/fRyY3asXNOM4RyuZqnMGIAuNBc8l3MdpK4xo0kO7QgejwgAVkRICvs+1TckLwCNUsriR7zhS7WIUsKmmqtZygX9BcNiMwfcFlJTCI32IuaqJ8AOoIKUEPPd7Iy7hR5xKXVMxBnDRUnD7QNnWCQ0n3EpeaaDzEofKGMBZ1xUG2DSrNdcP44L+ZzpDYWFkpejWXK3uYeaIjwjUmwgRHdAY00XU0711bqhJjLUTHdouQWxLodkO3JDCWhoVpzIENRiyI2aombJ12UWqsQqrlBYHBoxlbSYrqCZqOZO8Ld1bmLnUtA8MeHwTDs9Xh/kaVMQ2xiheKX/8SD71IfoAfkhs3Kf+FAl/JkYeuS8KozFDmM0ZAqCkYU8Wg5lgSNY2WMVczdskB861wpap1SSOeDqmdYgy4BxGG/BKn1JaRyTXJGeSyxxzXBF54JDnip++DN4AWMC54M/8GFdAVy7zTW8VLiQAc+VCtCKvATKZ01KeSrT7YrTpr6mOlT0SVwfDTuguteieiv1jB5qXp1687bhvinvGWRLzWAS/aR4cHfjtsjgtcngWZLMcEjYd15SSbkaX9SxB8m/RH4nzmn5ve0gvUOrkiVETnfF7N37P8lZ06NSNNPhDZrWjKRkrTUQzlRV52FZ/FGx3iR2vaydjfa3J8oa6oD3fov3c7yCfS+N1UMOZJ7kcakcn8F6w3c+w+d7+4YPWegytjk+pwvHN7LqZLksQOsqVQx2RKppv++16Eq0yP9ri2Uj16QLizXuLVbX+XWRxWPZEtyFx7q15PfQx/Slfj4qnPpGMuqAC2672D/nK1htBuvpvce1eI/hgfcY+5c0H25bQXr38V9JUl3212k/3EnvPzrP8EUNiJm7dyDXUe6XtSCofb4VpCR6hs3vDciVGBB0+OXHZHJJA2LeEXoD8r8q0jG+XYMBQf0ZU/cZvqwBaR8z9QbkguV+YQPSPnyZPn3pDcY5DYZ74C/cNh88Cx9c40P+LSHspyuMlvLbQvvPcisYlVdoob1n+Pci8vdnJjbODDvxDP2hSfcZHlssgy3DnVgG26kJGEUnEgRLouvf8uHDfPKofjay4jBBLwpnpIzFWNgo8wZjAZfNj4Krezu/vPbufwM= \ No newline at end of file diff --git a/Lab4/pom.xml b/Lab4/pom.xml new file mode 100644 index 0000000..372c7f3 --- /dev/null +++ b/Lab4/pom.xml @@ -0,0 +1,31 @@ + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.8 + 1.8 + + + + + + 4.0.0 + + gross.ryan + BankAccountManager + 1.0-SNAPSHOT + + + junit + junit + 4.12 + + \ No newline at end of file diff --git a/Lab4/src/main/java/gross/ryan/ATM.java b/Lab4/src/main/java/gross/ryan/ATM.java new file mode 100644 index 0000000..d6e3efa --- /dev/null +++ b/Lab4/src/main/java/gross/ryan/ATM.java @@ -0,0 +1,35 @@ +package gross.ryan; + +import java.lang.reflect.Array; +import java.util.ArrayList; + +/** + * Created by ryangross on 1/18/17. + */ +public class ATM { + private ArrayList allAccounts = new ArrayList(); + + public ArrayList getAllAccounts() { + return this.allAccounts; + } + + + protected void addAccount(Account anAcct) { + // getAllAccounts().add(anAcct); + allAccounts.add(anAcct); + } + + protected void createAccount(String name, double amount) { + Account newAccount = new CheckingAccount(name, amount); + addAccount(newAccount); + } + + protected Account getAccount(String name) { + for(int i = 0; i < allAccounts.size(); i++) { + System.out.println(allAccounts.get(i).getAccountBalance()); + return allAccounts.get(i); + } + return null; + } + +} diff --git a/Lab4/src/main/java/gross/ryan/Account.java b/Lab4/src/main/java/gross/ryan/Account.java new file mode 100644 index 0000000..7079f99 --- /dev/null +++ b/Lab4/src/main/java/gross/ryan/Account.java @@ -0,0 +1,49 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public abstract class Account { + private String accountHolder; + private double accountBalance; + private String accountType; + + public Account(String aName, double aBalance) { + setAccountHolder(aName); + setAccountBalance(aBalance ); + } + + public void setAccountHolder(String accountHolder) { + this.accountHolder = accountHolder; + } + + public void setAccountBalance(double anAmt) { + this.accountBalance = anAmt; + } + + public String getAccountHolder() { + return this.accountHolder; + } + + public double getAccountBalance() { + return this.accountBalance; + } + + private void debitAccount(double anAmt) { + this.accountBalance += anAmt; + } + + private void creditAccount(double anAmt) { + this.accountBalance -= anAmt; + } + + public void creditOrDebit(String aCommand, double anAmt) { + if (aCommand.equals("debit")) { + debitAccount(anAmt); + + } else { + creditAccount(anAmt); + } + } + +} diff --git a/Lab4/src/main/java/gross/ryan/CheckingAccount.java b/Lab4/src/main/java/gross/ryan/CheckingAccount.java new file mode 100644 index 0000000..56ed97f --- /dev/null +++ b/Lab4/src/main/java/gross/ryan/CheckingAccount.java @@ -0,0 +1,51 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class CheckingAccount extends Account { + private String accountHolder; + private double accountBalance; + private static String accountType = "checking"; + + public CheckingAccount(String aName, double anAmt) { + super(aName,anAmt); + } + + public String getAccountHolder() { + return this.accountHolder; + + } + + public void setAccountHolder(String name) { + this.accountHolder = name; + } + + public void setAccountBalance(double amount) { + this.accountBalance = amount; + } + + public double getAccountBalance() { + return this.accountBalance; + } + + private void debitAccount(double anAmt) { + this.accountBalance += anAmt; + System.out.println(anAmt + " added to your account. Balance is now: " + getAccountBalance()); + } + + private void creditAccount(double anAmt) { + this.accountBalance -= anAmt; + System.out.println(anAmt + " deducted from your account. Balance is now: " + getAccountBalance()); + } + + public void creditOrDebit(String aCommand, double anAmt) { + if (aCommand.equals("debit")) { + debitAccount(anAmt); + + } else { + creditAccount(anAmt); + } + } + +} diff --git a/Lab4/src/main/java/gross/ryan/InvestmentAccount.java b/Lab4/src/main/java/gross/ryan/InvestmentAccount.java new file mode 100644 index 0000000..b2713f7 --- /dev/null +++ b/Lab4/src/main/java/gross/ryan/InvestmentAccount.java @@ -0,0 +1,50 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class InvestmentAccount extends Account{ + private String accountHolder; + private double accountBalance; + private static String accountType = "investment"; + + public InvestmentAccount(String aName, double anAmt) { + super(aName,anAmt); + } + + @Override + public void setAccountHolder(String accountHolder) { + this.accountHolder = accountHolder; + } + + @Override + public void setAccountBalance(double accountBalance) { + this.accountBalance = accountBalance; + } + + public String getAccountHolder() { + return this.accountHolder; + + } + + public double getAccountBalance() { + return this.accountBalance; + } + + private void debitAccount(double anAmt) { + this.accountBalance += anAmt; + } + + private void creditAccount(double anAmt) { + this.accountBalance -= anAmt; + } + + public void creditOrDebit(String aCommand, double anAmt) { + if (aCommand.equals("debit")) { + debitAccount(anAmt); + + } else { + creditAccount(anAmt); + } + } +} diff --git a/Lab4/src/main/java/gross/ryan/Main.java b/Lab4/src/main/java/gross/ryan/Main.java new file mode 100644 index 0000000..a60a2e4 --- /dev/null +++ b/Lab4/src/main/java/gross/ryan/Main.java @@ -0,0 +1,20 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class Main { + + public static void main(String[] args) { + ATM initATM = new ATM(); + /* + CheckingAccount ryan = new CheckingAccount("Ryan", 100.00); + initATM.addAccount(ryan); + System.out.println(initATM.getAllAccounts().get(0).getAccountHolder()); + initATM.getAccount("ryan"); + */ + initATM.createAccount("Ryan",100.00); + initATM.getAccount("Ryan").creditOrDebit("debit",100.00); + initATM.getAccount("Ryan").getAccountBalance(); + } +} diff --git a/Lab4/src/main/java/gross/ryan/SavingsAccount.java b/Lab4/src/main/java/gross/ryan/SavingsAccount.java new file mode 100644 index 0000000..ce5d3ec --- /dev/null +++ b/Lab4/src/main/java/gross/ryan/SavingsAccount.java @@ -0,0 +1,51 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class SavingsAccount extends Account { + private String accountHolder; + private double accountBalance; + private static final String accountType = "savings"; + + public SavingsAccount(String aName, double anAmt) { + super(aName,anAmt); + } + + public String getAccountHolder() { + return this.accountHolder; + + } + + @Override + public void setAccountHolder(String accountHolder) { + this.accountHolder = accountHolder; + } + + @Override + public void setAccountBalance(double accountBalance) { + this.accountBalance = accountBalance; + } + + public double getAccountBalance() { + return this.accountBalance; + } + + private void debitAccount(double anAmt) { + this.accountBalance += anAmt; + } + + private void creditAccount(double anAmt) { + this.accountBalance -= anAmt; + } + + public void creditOrDebit(String aCommand, double anAmt) { + if (aCommand.equals("debit")) { + debitAccount(anAmt); + + } else { + creditAccount(anAmt); + } + } + +} diff --git a/Lab4/src/test/java/gross/ryan/AccountTest.java b/Lab4/src/test/java/gross/ryan/AccountTest.java new file mode 100644 index 0000000..d2f8627 --- /dev/null +++ b/Lab4/src/test/java/gross/ryan/AccountTest.java @@ -0,0 +1,7 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class AccountTest { +} diff --git a/Lab4/src/test/java/gross/ryan/CheckingAccountTest.java b/Lab4/src/test/java/gross/ryan/CheckingAccountTest.java new file mode 100644 index 0000000..0702814 --- /dev/null +++ b/Lab4/src/test/java/gross/ryan/CheckingAccountTest.java @@ -0,0 +1,7 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class CheckingAccountTest { +} diff --git a/Lab4/src/test/java/gross/ryan/InvestmentAccountTest.java b/Lab4/src/test/java/gross/ryan/InvestmentAccountTest.java new file mode 100644 index 0000000..0413fd2 --- /dev/null +++ b/Lab4/src/test/java/gross/ryan/InvestmentAccountTest.java @@ -0,0 +1,7 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class InvestmentAccountTest { +} diff --git a/Lab4/src/test/java/gross/ryan/SavingsAccountTest.java b/Lab4/src/test/java/gross/ryan/SavingsAccountTest.java new file mode 100644 index 0000000..1bd88c0 --- /dev/null +++ b/Lab4/src/test/java/gross/ryan/SavingsAccountTest.java @@ -0,0 +1,7 @@ +package gross.ryan; + +/** + * Created by ryangross on 1/18/17. + */ +public class SavingsAccountTest { +}