Open
Conversation
added 29 commits
January 15, 2025 09:58
…asses and test classes necessary for the core exercise.
Method for addAccount() in BankBranch-class completed.
…> listOfTransactions in the BankAccountTest-class
…tructor for the BankAccount class, thus I needed to update the constructor for CurrentAccount and SavingsAccount classes.
…pdate BankBranchTest where BankAccounts where instansiated
…ent to the constructor in BankAccount in order to not fail.
Added a "-" mark when populating the listOfTransactions in the BankAccountTest class so that the correct balance was calculated. Added an extra test to make sure that you cant deposit negative values.
…ng test, a "-" mark had changed place between the two tests. This was also fixed.
…us also the testclass. This is because I needed access to the balance anyway to correctly format the strings that should be outputed in the generateBankStatement() method.
…antiating a new object, thus I would be able to format the transaction in the Transaction class. I changed the class diagram and also all the places where transactions are instansiated.
…de the tests for formatTransactionForBankStatement() in Transaction
…t I did my previous code with having the "amount" of a withdraw-transacting being negative. This caused problem with the generateBankStatements(), thus I changed it to be a positive number, resulting in changes needed elsewhere
…ance so it it calculated every time it is called.
…for this.balance so it it calculated every time it is called. I also changed this.balance to this.getBalance() in the code in class BankAccount
…for extension 2, however I added "bankID" to the BankAccount class so that you could specify that BankAccounts thats added to the list belong to that specific BankBranch
…for extension 2, however I added "bankID" to the BankAccount class so that you could specify that BankAccounts thats added to the list belong to that specific BankBranch
…ged the test to being a Boolean, it made more sense.
ninja-aruna
reviewed
Jan 15, 2025
| public Double getBalance() { | ||
| Double calculatedBalance = 0D; | ||
| for(Transaction transaction : listOfTransactions){ | ||
| if(transaction.getTypeOfTransaction().equals("Withdraw")){ |
There was a problem hiding this comment.
It would be better to use an enum here to get strong typing
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.