Skip to content

Aaron Herion ATM Lab Submission #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Zipcode ATM Lab UML.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" version="7.6.0" editor="www.draw.io" type="github"><diagram name="Page-1" id="929967ad-93f9-6ef4-fab6-5d389245f69c">7Vzfc5s4EP5rPHP34Azitx+dtLl2pu11Jun07t4UUAxTjDghx8n99SchBEjIju2A7aR9iWElVmK/b1fSSmTiXC0f/yCwSD7jGGUT24ofJ867iW0DYFvsh0uehCQIbCFYkDSuK7WCm/Q/VAvr5xarNEalUpFinNG0UIURznMUUUUGCcFrtdo9ztRWC7hAPcFNBDMpvfBa+fc0pol8M3/WFnxA6SKpGw9tXxTcwejHguBVXreY4xyJkiWUauq3LBMY43VH5LyfOFcEYyqulo9XKOOGlTaTz9En2dGJc5nQZcZuALusiq83PAx2eZi9F0E57Ta3UZ8f2LHvu65zPwPozpvWDTzAbCUbsP2M6boslHb9f1f8DS+XkCzSfOLMWalVPLK/VS8sIZ9SXIgyt1+WoXsqCkH3SYoe6RRm6aLWWlVr2mNXi/q36tWdFPyTFhGjMHtgfvuZ/f0EWZH17fMn9nfKpZDgnP1+QCTlF+JxZpk7XSWTFa1MM3fH1iUl+EdDrEqSwILXWz4uuEtdlE/lMrsoGJkqqnaBwg+I3GcVce5TBolzuU5Sim5YZa5hzZ5nMl50hTNMmKj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62ztDOeAFLX1keOsXoaxoQzP1SFj8LmPreFbD05OSuYOrLz76mAcHcL+HQB/O1weIeOjkL9G9ndUUDgmLaiHxLoOhflPvg0Bkz8DVNI8a9/TIsrw+Vfio8PDCCAdext2s6GBZ22/7PSFG9/a+czvv/AQ==</diagram></mxfile>
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,15 @@
<artifactId>project-2-atm</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

</dependencies>


</project>
75 changes: 75 additions & 0 deletions src/main/java/Account.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import java.util.ArrayList;

public class Account {

private double balance;
private int accountNum;
private String accountType;
private ArrayList<String> transactionHistory = new ArrayList<String>();


public Account(double balance, int accountNum, String accountType) {
this.balance = balance;
this.accountNum = accountNum;
this.accountType = accountType;

}

public double withdraw(double userAmount) {

this.balance -= userAmount;
return balance;
}

public double deposit(double userAmount) {

this.balance += userAmount;
return balance;
}

private void transferTo() {


}

private void viewTransactions() {

}

public double showBalance(double balanceAmount) {

this.balance = balanceAmount;
return balanceAmount;
}

double getBalance() {

return balance;
}

public void setBalance(double newBalance) {


}

int getAccountNum() {

return accountNum;
}

public void setAccountNum(double newAccountNum) {

}

String getAccountType() {

return accountType;
}

public ArrayList<String> getTransactionHistory() {

return transactionHistory;
}


}
83 changes: 83 additions & 0 deletions src/main/java/Account_Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import org.junit.Assert;
import org.junit.Test;

public class Account_Test {

@Test
public void AccountTest() {
//: Given
Account getBalNumTypeTest = new Account(123, 123, "Checking");
double expected = 123;
int expected2 = 123;
String expected3 = "Checking";

//: When
double actual = getBalNumTypeTest.getBalance();
int actual2 = getBalNumTypeTest.getAccountNum();
String actual3 = getBalNumTypeTest.getAccountType();

//: Then
Assert.assertTrue(expected == actual);
Assert.assertEquals(expected2, actual2);
Assert.assertEquals(expected3, actual3);

}

@Test
public void withdrawTest() {
//: Given
Account withdrawTest = new Account(123, 456, "Savings");
double expected = 100;
int expected2 = 456;
String expected3 = "Savings";
//: When
double actual = withdrawTest.withdraw(23);
int actual2 = 456;
String actual3 = "Savings";
//: Then
Assert.assertTrue(expected == actual);
Assert.assertEquals(expected2, actual2);
Assert.assertEquals(expected3, actual3);


}

@Test
public void depositTest() {
//: Given
Account depositTest = new Account(123, 789, "Investment");
double expected = 150;
int expected2 = 789;
String expected3 = "Investment";
//: When
double actual = depositTest.deposit(27);
int actual2 = 789;
String actual3 = "Investment";
//: Then
Assert.assertTrue(expected == actual);
Assert.assertEquals(expected2, actual2);
Assert.assertEquals(expected3, actual3);
}

@Test
public void showBalanceTest() {
//: Given
Account showBalanceTest = new Account(123,101112,"Checking");
double expected = 200;
double expected2 = 200;
int expected3 = 101112;
String expected4 = "Checking";
//: When
double actual = showBalanceTest.deposit(77);
double actual2 = showBalanceTest.showBalance(200);
int actual3 = 101112;
String actual4 = "Checking";
//: Then
Assert.assertTrue(expected == actual);
Assert.assertTrue (expected2 == actual2);
Assert.assertEquals(expected3, actual3);
Assert.assertEquals(expected4, actual4);
}


}
5 changes: 5 additions & 0 deletions src/main/java/Checking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class Checking extends Account {
public Checking(double balance, int accountNum, String accountType) {
super(balance, accountNum, accountType);
}
}
148 changes: 148 additions & 0 deletions src/main/java/Console.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
//package com.company;
//
//import java.util.Scanner;
//
//public class Console {
//
// public static void main(String[] args) {
//
// Scanner userInput = new Scanner(System.in);
//
//
// //User log-in interface:
// System.out.println("Existing user? Select '1' to log-in;\n" +
// " New user? Select '2' to create a new account");
//
// int loginReply = userInput.nextInt();
// if (loginReply == 1) {
// System.out.println("Please enter your username");
// } else {
// /*need to setup Account Factory*/
// }
//
// String username = userInput.nextLine();
// if (username.equalsIgnoreCase(/*need to setup username system*/)) {
// System.out.println("Please enter your password");
// } else {
// System.out.println("Incorrect username, please try again");
// }
//
// String password = userInput.nextLine();
// if (password.equalsIgnoreCase(/*need to setup password system*/)) {
// //if password accepted need to take user to user account selection stage
// } else {
// System.out.println("Incorrect password, please try again");
// }
//
//
// //User account interactions/transactions:
// while ( boolean exit !=false){
// System.out.println("Choose an account:\n " +
// "Select '1' for Checking\n " +
// "Select '2' for Savings\n " +
// "Select '3' for Investment\n" +
// "Select '4' to log-out and exit this session");
// int chooseAccountReply = userInput.nextInt();
// if (chooseAccountReply == 1) {
// //call checking
// int chooseTransactionReply = userInput.nextInt();
// System.out.println("Choose a transaction type or option: " +
// "Select '1' to withdraw from your account\n " +
// "Select '2' to deposit into your account\n" +
// "Select '3' to transfer funds to another account\n" +
// "Select '4' to view your transaction history\n" +
// "Select '5' to show your account balance\n" +
// "Select '6' to log-out and exit this session");
// if (chooseTransactionReply == 1) {
// //call to withdraw from checking
// }
// if (chooseTransactionReply == 2) {
// //call to deposit to checking
// }
// if (chooseTransactionReply == 3) {
// //call to transfer from checking to subsequent chosen account
// }
// if (chooseTransactionReply == 4) {
// //call to view transaction history
// }
// if (chooseTransactionReply == 5) {
// //call to show checking account balance
// }
// if (chooseTransactionReply == 6) {
// exit = false;
// //log-out user and clear console
// }
// }
// if (chooseAccountReply == 2) {
// //call savings
// int chooseTransactionReply2 = userInput.nextInt();
// System.out.println("Choose a transaction type or option: " +
// "Select '1' to withdraw from your account\n " +
// "Select '2' to deposit into your account\n" +
// "Select '3' to transfer funds to another account\n" +
// "Select '4' to view your transaction history\n" +
// "Select '5' to show your account balance\n" +
// "Select '6' to log-out and exit this session");
// if (chooseTransactionReply2 == 1) {
// //call to withdraw from savings
// }
// if (chooseTransactionReply2 == 2) {
// //call to deposit to savings
// }
// if (chooseTransactionReply2 == 3) {
// //call to transfer from savings to subsequent chosen account
// }
// if (chooseTransactionReply2 == 4) {
// //call to view transaction history
// }
// if (chooseTransactionReply2 == 5) {
// //call to show savings balance
// }
// if (chooseTransactionReply2 == 6) {
// exit = false;
// //log-out user and clear console
// }
//
// }
// if (chooseAccountReply == 3) {
// //call investment
// int chooseTransactionReply3 = userInput.nextInt();
// System.out.println("Choose a transaction type or option: " +
// "Select '1' to withdraw from your account\n " +
// "Select '2' to deposit into your account\n" +
// "Select '3' to transfer funds to another account\n" +
// "Select '4' to view your transaction history\n" +
// "Select '5' to show your account balance\n" +
// "Select '6' to log-out and exit this session");
// if (chooseTransactionReply3 == 1) {
// //call to withdraw from investment
// }
// if (chooseTransactionReply3 == 2) {
// //call to deposit to investment
// }
// if (chooseTransactionReply3 == 3) {
// //call to transfer from investment to subsequent chosen account
// }
// if (chooseTransactionReply3 == 4) {
// //call to view transaction history
// }
// if (chooseTransactionReply3 == 5) {
// //call to show investment account balance
// }
// if (chooseTransactionReply3 == 6) {
// exit = false;
// //log-out user and clear console
// }
// }
// if (chooseAccountReply == 4) {
// exit = false;
// //log-out user and clear console
//
// }
//
//
// }
//
// }
//
//}
5 changes: 5 additions & 0 deletions src/main/java/Investment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class Investment extends Account {
public Investment(double balance, int accountNum, String accountType) {
super(balance, accountNum, accountType);
}
}
10 changes: 4 additions & 6 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/**
* Created by iyasuwatts on 10/17/17.
*/
package com.company;

public class Main {

public static void main(String[] args){

}


}
5 changes: 5 additions & 0 deletions src/main/java/Savings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class Savings extends Account {
public Savings(double balance, int accountNum, String accountType) {
super(balance, accountNum, accountType);
}
}
Loading