Skip to content

Monali2 #40

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 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d170664
Initial commit: setting up User class
Mar 13, 2021
f19ec33
fleshed out constructors and defined method signatures. method bodies…
Mar 13, 2021
f957aad
added method test signature definitions to UserTest class
KellyPorter02 Mar 13, 2021
a84a8dd
checkpointing - some method bodies complete, all test method signatur…
KellyPorter02 Mar 13, 2021
49509a7
all method bodies of User class complete
KellyPorter02 Mar 13, 2021
95b0229
checkpointing: test class skeleton almost complete, need to write tes…
KellyPorter02 Mar 13, 2021
0afe802
fixed some syntax errors in the User test class
KellyPorter02 Mar 13, 2021
677b912
Merge branch 'kellyBranch'
KellyPorter02 Mar 13, 2021
ece70e7
attempting to push User class skeleton
KellyPorter02 Mar 13, 2021
0e5b48a
added two classes ATM and Account and deleted main
Monali-Khandelwal Mar 14, 2021
b579cf1
Created login/logout, create new account, welcome menu, & console
theresa-christina Mar 14, 2021
bdd4533
Made some small changes
theresa-christina Mar 14, 2021
3c9973e
Merge pull request #2 from theresa-mashura/theresa
theresa-christina Mar 14, 2021
5c4a99b
adding some more changes
Monali-Khandelwal Mar 14, 2021
15a7ea0
merging changes from master and my local
Monali-Khandelwal Mar 14, 2021
d0a4940
Merge pull request #3 from theresa-mashura/Monali2
theresa-christina Mar 14, 2021
84f3bb9
Worked on merging together our code
theresa-christina Mar 14, 2021
bf05f8c
Merge pull request #4 from theresa-mashura/theresa
theresa-christina Mar 14, 2021
727741c
Added ability to close account & switch between accounts w/o losing d…
theresa-christina Mar 14, 2021
e2f6b38
Some small changes
theresa-christina Mar 14, 2021
782063d
Some minor changes
theresa-christina Mar 14, 2021
b4b45ed
Merge pull request #5 from theresa-mashura/theresa
theresa-christina Mar 14, 2021
0bed77d
Contructor tests for Account class
KellyPorter02 Mar 14, 2021
2ba38b1
merged
KellyPorter02 Mar 14, 2021
e146eb7
Merge pull request #7 from theresa-mashura/kellyBranch
theresa-christina Mar 14, 2021
98d4eb8
initial commit after latest pull from remote master
KellyPorter02 Mar 15, 2021
8256316
checkpointing: BankAccount class method tests 60% complete
KellyPorter02 Mar 15, 2021
1759214
Added unit tests for UserManagement class
theresa-christina Mar 15, 2021
5b91ec2
tests for BankAccount complete
KellyPorter02 Mar 15, 2021
f10f805
Added some UserAccount unit tests
theresa-christina Mar 15, 2021
c304189
Merge pull request #8 from theresa-mashura/theresa
theresa-christina Mar 15, 2021
d5eb193
Merge branch 'master' into kellyBranch
theresa-christina Mar 15, 2021
3af3e0c
Merge pull request #9 from theresa-mashura/kellyBranch
theresa-christina Mar 15, 2021
1665f32
Update BankAccountTest.java
theresa-christina Mar 15, 2021
002de75
Latest changes
Monali-Khandelwal Mar 15, 2021
2d706d2
removing merge conflicts
Monali-Khandelwal Mar 15, 2021
b598f8d
A couple small changes to tests
theresa-christina Mar 15, 2021
44c4534
Merge pull request #10 from theresa-mashura/theresa
theresa-christina Mar 15, 2021
fa85d22
Fix a typo
theresa-christina Mar 15, 2021
af305ec
Merge pull request #11 from theresa-mashura/theresa
theresa-christina Mar 15, 2021
b533b38
changes to recipt display
Monali-Khandelwal Mar 15, 2021
f7e2051
fixed the merge conflicts after pull origin master
Monali-Khandelwal Mar 15, 2021
34696ba
Merge pull request #12 from theresa-mashura/Monali2
theresa-christina Mar 15, 2021
37cbace
Minor changes
theresa-christina Mar 15, 2021
aa507b1
Merge pull request #13 from theresa-mashura/theresa
theresa-christina Mar 15, 2021
93f329e
Deleted the non working tests
Monali-Khandelwal Mar 15, 2021
83b476c
Final changes
Monali-Khandelwal Mar 15, 2021
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
24 changes: 13 additions & 11 deletions src/main/java/BankAccount.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import java.text.NumberFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;



public class BankAccount {


private String accountType;
public String accountType;
private double currentBalance;
NumberFormat formatter = NumberFormat.getCurrencyInstance();

Expand All @@ -22,13 +21,20 @@ public BankAccount(String chosenAccountType) {
void setType(String accType) {
accountType = accType;
}

void setBalance(Double accBal) {
currentBalance = accBal;
}
public String getAccountType() {
return this.accountType;
}

public String getAccountType() { return accountType; }

Double getBalance() {
return currentBalance;
}

void deposit(Double dep) {
currentBalance = currentBalance + dep;
}
Expand All @@ -37,22 +43,18 @@ void withdraw(Double wit) {
currentBalance = currentBalance - wit;
}

Double getBalance() {
return currentBalance;
}

void printTxn(String txnType, Double amt, Double balance){

System.out.println("");

System.out.println("|----------------------------------------|");
System.out.println("| BANK OF ZIP CODE WILMINGTON DE |");
System.out.println("|----------------------------------------|");
System.out.println("|" + dateTime() + " "+"|");
System.out.println("|----------------------------------------|");
System.out.println("| Transaction Receipt |");
System.out.println("|" + txnType + " " +"|");
System.out.println("|" + amt + "" + " "+ "|");
System.out.println("| Remaining Balance: " + balance + " " + "|");
System.out.println("| Transaction Receipt |");
System.out.println("|" + txnType + " " +"|");
System.out.println("|" + amt + "" + " "+ "|");
System.out.println("| Remaining Balance: " + balance + " " + "|");
System.out.println("|----------------------------------------|");

}
Expand Down
217 changes: 94 additions & 123 deletions src/main/test/BankAccountTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import org.junit.Test;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.Scanner;


// Test the expected Account class from ATM.
public class BankAccountTest {
Expand All @@ -16,150 +13,124 @@ public void constructorCActTypeTest1() { // tests creation of checking account -
String returnedCAcctType = testAccount.checking.type;
Assert.assertEquals(givenCAcctType, returnedCAcctType);

}

@Test
public void constructorCActBalTest2() { // tests creation of checking account - balance equals zero @ creation
// Arrange
Account testAccount = new Account();
System.out.println(testAccount.checking.balance);
double givenCAcctBal = 0.00;
double returnedCAcctBal = testAccount.checking.balance;
Assert.assertEquals(givenCAcctBal, returnedCAcctBal);
public void constructorInitialBalanceTest1() { // tests account balance 0.0 upon creation of BankAccount
//Arrange
String givenAccountType = "Checking";
Double givenCurrentBalance = 0.0;
//Act
BankAccount testBankAccount = new BankAccount(givenAccountType);
Double returnedBalance = testBankAccount.getBalance();
//Assert
Assert.assertEquals(givenCurrentBalance, returnedBalance);
}

@Test
public void constructorTestSActType3() { // tests creation of savings account - type field
// Arrange
Account testAccount = new Account();
System.out.println(testAccount.savings.type);
String givenSAcctType = "Savings";
String returnedSAcctType = testAccount.savings.type;
Assert.assertEquals(givenSAcctType, returnedSAcctType);
public void constructorAcctTypeArgTest2() { // tests creation of BankAccount sets account type
//Arrange
String givenAccountType = "Checking";
//Act
BankAccount testBankAccount = new BankAccount(givenAccountType);
String returnedAccountType = testBankAccount.accountType;
//Assert
Assert.assertEquals(givenAccountType, returnedAccountType);

}

@Test
public void constructorTestSActBal4() { // tests creation of savings account - balance equals zero @ creation
// Arrange
Account testAccount = new Account();
System.out.println(testAccount.savings.balance);
double givenSAcctBal = 0.00;
double returnedSAcctBal = testAccount.savings.balance;
Assert.assertEquals(givenSAcctBal, returnedSAcctBal);

public void setTypeTest() { // tests method to reset account type
//Arrange
String givenAccountType = "Checking";
Double givenCurrentBalance = 0.0;
//Act
BankAccount testBankAccount = new BankAccount(givenAccountType);
testBankAccount.setType("Savings");
String returnedAccountType = testBankAccount.getAccountType();
//Assert
Assert.assertEquals(givenAccountType, returnedAccountType);
}

@Test
public void constructorTestTxHxType5() { // tests creation of transactionHistory - type
// Arrange
Account testAccount = new Account();
System.out.println(testAccount.TxnHistory.type);
String givenTxHxType = "Transaction";
String returnedTxHxType = testAccount.TxnHistory.type;
Assert.assertEquals(givenTxHxType, returnedTxHxType);

public void getAccountTypeTest() { // tests method for return account type
//Arrange
String givenAccountType = "Checking";
//Act
BankAccount testBankAccount = new BankAccount(givenAccountType);
String returnedAccountType = testBankAccount.getAccountType();
//Assert
Assert.assertEquals(givenAccountType, returnedAccountType);
}

@Test
public void depositMoneyTest1() {
// Arrange
Scanner sc = new Scanner(System.in);
Integer depAccount = sc.nextInt(1);
Account testAccount = new Account();
testAccount.depositMoney();

public void setBalanceTest() { // tests method to reset account balance
//Arrange
String givenAccountType = "Investment";
Double givenCurrentBalance = 0.0;
Double expectedAccountBal = 100.0;
//Act
BankAccount testBankAccount = new BankAccount(givenAccountType);
testBankAccount.setBalance(100.0);
Double returnedAccountBal = testBankAccount.getBalance();
//Assert
Assert.assertEquals(expectedAccountBal, returnedAccountBal);
}

@Test
public void withdrawMoneyTest1() {

public void getBalanceTest() { // tests method to reset account balance
//Arrange
String givenAccountType = "Investment";
Double givenCurrentBalance = 0.0;
Double expectedAccountBal = 100.0;
//Act
BankAccount testBankAccount = new BankAccount(givenAccountType);
testBankAccount.setBalance(100.0);
Double returnedAccountBal = testBankAccount.getBalance();
//Assert
Assert.assertEquals(expectedAccountBal, returnedAccountBal);
}

@Test
public void transferMoneyTest1() {

public void depositTest() {
//Arrange
String givenAccountType = "Investment";
Double expectedAccountBal = 200.0;
//Act
BankAccount testBankAccount = new BankAccount(givenAccountType);
testBankAccount.setBalance(100.00);
testBankAccount.deposit(100.0);
Double returnedAccountBalance = testBankAccount.getBalance();
//Assert
Assert.assertEquals(expectedAccountBal, returnedAccountBalance);
}

@Test
public void checkBalance1() {

public void withdrawTest() {
//Arrange
String givenAccountType = "Investment";
Double expectedAccountBal = 0.0;
//Act
BankAccount testBankAccount = new BankAccount(givenAccountType);
testBankAccount.setBalance(100.00);
testBankAccount.withdraw(100.0);
Double returnedAccountBalance = testBankAccount.getBalance();
//Assert
Assert.assertEquals(expectedAccountBal, returnedAccountBalance);
}

*/




// @Test
// public void testA0() {
// Account a = new Account(0.0);
// assertEquals(0.0, a.balance(), 0.0001);
// }
//
// @Test
// public void testA00() {
// Account a = new Account(10.0);
// assertEquals(10.0, a.balance(), 0.0001);
// }
//
// @Test
// public void testA01() {
// Account a = new Account(0.0);
// assertEquals(true, a.closeAccount());
// }
//
// @Test
// public void testA02() {
// Account a = new Account(10.0);
// assertEquals(false, a.closeAccount());
// }
//
// @Test
// public void testA1() {
// Account a = new Account(0.0);
// a.deposit(100.0);
// assertEquals(100.0, a.balance(), 0.0001);
// }
//
// @Test
// public void testA2() {
// Account a = new Account(10.0);
// a.deposit(100.0);
// assertEquals(110.0, a.balance(), 0.0001);
// }
//
// @Test
// public void testA3() {
// Account a = new Account(200.0);
// Double actual = a.withdraw(100.0);
// assertEquals(100.0, actual, 0.0001);
// }
//
// @Test
// public void testA4() {
// Account a = new Account(0.0);
// Double actual = a.withdraw(1.0);
// assertEquals(0.0, actual, 0.0001);
// }
//
// @Test
// public void testA5() {
// Account a = new Account(10.0);
// Account b = new Account(0.0);
// a.transfer(b, 10.0);
// assertEquals(0.0, a.balance(), 0.0001);
// assertEquals(10.0, b.balance(), 0.0001);
// }
//
// @Test
// public void testA6() {
// Account a = new Account(10.0);
// Account b = new Account(0.0);
// a.transfer(b, 100.0); // nothing should happen
// assertEquals(10.0, a.balance(), 0.0001);
// assertEquals(0.0, b.balance(), 0.0001);
// }

@Test
public void dateTimeTest() { // tests return of date and time method
//Arrange
String givenAccountType = "Checking";
//Act
BankAccount testBankAccount1 = new BankAccount(givenAccountType);
BankAccount testBankAccount2 = new BankAccount(givenAccountType);
System.out.println(testBankAccount1.dateTime());
System.out.println(testBankAccount2.dateTime());
String expectedDateTime = testBankAccount1.dateTime();
String returnedDateTime = testBankAccount2.dateTime();
//Assert
Assert.assertEquals(expectedDateTime, returnedDateTime);
}

}
2 changes: 0 additions & 2 deletions src/main/test/UserAccountTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

// Test the expected User class from ATM.
import org.testng.Assert;
import org.testng.annotations.Test;

public class UserAccountTest {

Expand Down