diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..c93a347 Binary files /dev/null and b/.DS_Store differ diff --git a/Lab1/.DS_Store b/Lab1/.DS_Store new file mode 100644 index 0000000..ae70feb Binary files /dev/null and b/Lab1/.DS_Store differ diff --git a/Lab1/RotatingArray/.DS_Store b/Lab1/RotatingArray/.DS_Store new file mode 100644 index 0000000..d8e73ee Binary files /dev/null and b/Lab1/RotatingArray/.DS_Store differ diff --git a/Lab1/RotatingArray/classes/.DS_Store b/Lab1/RotatingArray/classes/.DS_Store new file mode 100644 index 0000000..c4784f7 Binary files /dev/null and b/Lab1/RotatingArray/classes/.DS_Store differ diff --git a/Lab1/RotatingArray/classes/gross/.DS_Store b/Lab1/RotatingArray/classes/gross/.DS_Store new file mode 100644 index 0000000..dfd7e0b Binary files /dev/null and b/Lab1/RotatingArray/classes/gross/.DS_Store differ diff --git a/Lab1/RotatingArray/generated-sources/.DS_Store b/Lab1/RotatingArray/generated-sources/.DS_Store new file mode 100644 index 0000000..7ddce43 Binary files /dev/null and b/Lab1/RotatingArray/generated-sources/.DS_Store differ diff --git a/Lab1/pom.xml b/Lab1/pom.xml new file mode 100644 index 0000000..a2e27f4 --- /dev/null +++ b/Lab1/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/Lab1/src/main/java/gross/ryan/RotateArray.java b/Lab1/src/main/java/gross/ryan/RotateArray.java new file mode 100644 index 0000000..5694cc6 --- /dev/null +++ b/Lab1/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); + } + +} diff --git a/Lab2/pom.xml b/Lab2/pom.xml new file mode 100644 index 0000000..9c36745 --- /dev/null +++ b/Lab2/pom.xml @@ -0,0 +1,18 @@ + + + 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; + } + + +} diff --git a/Lab3/ProductInventory.xml b/Lab3/ProductInventory.xml new file mode 100644 index 0000000..6a8e544 --- /dev/null +++ b/Lab3/ProductInventory.xml @@ -0,0 +1,2 @@ + +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..89a4a02 --- /dev/null +++ b/Lab3/src/main/java/gross/ryan/Main.java @@ -0,0 +1,18 @@ +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); + } + +} 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 { +}