Skip to content

Mattias Hedbom#124

Open
Hedbom98 wants to merge 29 commits intoboolean-uk:mainfrom
Hedbom98:main
Open

Mattias Hedbom#124
Hedbom98 wants to merge 29 commits intoboolean-uk:mainfrom
Hedbom98:main

Conversation

@Hedbom98
Copy link

No description provided.

Mattias Hedbom 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.
Copy link

@ninja-aruna ninja-aruna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really good start :)

public Double getBalance() {
Double calculatedBalance = 0D;
for(Transaction transaction : listOfTransactions){
if(transaction.getTypeOfTransaction().equals("Withdraw")){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use an enum here to get strong typing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants