File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Still trying to create a Bank for my BankAccounts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Still trying to create a Bank for my BankAccounts" Watch "Still trying to create a Bank for my BankAccounts" New topic
Author

Still trying to create a Bank for my BankAccounts

Jenny Daniels
Greenhorn

Joined: Oct 23, 2012
Posts: 5

Hi! I'm having some difficulty with a practice problem that involves creating a Bank and BankAccount class to be tested later against a tester class. The tester has reference to a single Bank object which 'owns' many BankAccount objects.

Here is my code for the Bank and BankAccount classes.

I am pretty sure my BanAccount code is correct but I am not sure the bank is doing what it's supposed to... any help would be much appreciated. I know Bank is supposed to be set up in a way that the instance methods for the bank class are described as so:

addAccount (int acctNum, double initialDeposit) : void -calls constructor

deposit (int acctNum, double amount): void -calls deposit(..)

withdraw (int acctNum, double amount): void -calls withdraw(..)

getBalance(int acctNum): double -calls getBalance()

suspend/open/closeAccount (int acctNum): void -calls suspend()/open()/close() to change account status

getAccountStatus(int acctNum): String -returns the account's status by calling getStatus()

accountTransactionsString(int acctNum): String -calls transactionsString()

summarizeAllAccounts(): String -returns a summary of the bank's accounts (similar to what I've been trying to describe)
Red Smith
Ranch Hand

Joined: Aug 05, 2007
Posts: 136
    
    1
Why have you made the data and the methods of the BankAccount class static?
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Hello and welcome to the Ranch!

Please TellTheDetails (<- click) when posting a question. Saying that there is something wrong with your code won't help you much, because you should point to a specific part of code that you think is wrong. Once you target problematic part of code you should post it here so we can all take a look and discuss it. Providing a link to your git repository is not such a good idea, since you can delete repository after some time and the post here remains. So for someone who checks the thread later it can be really confusing reading a discussion without knowing anything about the details of the problem you are facing.

As Red Smith pointed out, for start you should change methods not to be static (if you really don't have a good reason to leave them as such, and I think you don't).


The quieter you are, the more you are able to hear.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Still trying to create a Bank for my BankAccounts