Banking System UML Class Diagram in to code.
Hi again,
today we got given this problem:
The LandL bank can handle at least 30 customers who have savings accounts.
* Design and then implement a program which manages deposits and withdrawls.
* Produce suitable error messages for invalid transactions
* Add a method which adds 3% to all accounts when it is invoked.
In class today we designed a class diagram in a group and this is our result: (tutor said tis fine and now we need to code it):
Bank Class
-customers: ArrayList<Customer>
+getCustomerById(int): Customer
Customer Class
-customerId: int
-name: String
-accounts: ArrayList<Account>
+getCustomerId()
+getName()
+getAccount(int)
Account Class
-accountId: int
-balance: double
+getId(): int
+getbalance(): double
+deposit(double)
+withdraw(double)
+rasieByPercentage(double)
I am using netbeans to code this in java
I have a few questions please that would help me get started.
How many Main classes and normal classes do i need?
What should the programs actually do?
do i create 30 names for customers in an Array?
do i ask for user input by typing in a name and then ask what they want to do i.e. make a deposit, make a withdrawal and request balance
What do they mean by: Add a method which adds 3% to all accounts when it is invoked.
Many thanks for your help
Re: Banking System UML Class Diagram in to code.
According to your specifications, there are no "main classes" (I'm assuming this refers to classes with the static entry-point main method). However, I would create a separate class (i.e. not one listed above) that you does have a main method and allows you to test your other classes with.
The specifications seem to denote that your program should act like a library that can be used by some front end (either a command-line app, gui app, or even web-based app). It's also possible that the front end has no user interface at all, for example a test class which runs the library with different parameters and test situations to make sure it works.
You're already using an ArrayList in your bank class, why would you need a second array?
Ideally your program should not ask for any user input, it should receive method parameters and operate on those. If you wanted to you can create a separate front end which you can play around your library with.
It sounds like you're suppose to increase the amount of money in each account by 3% of its previous value.
Re: Banking System UML Class Diagram in to code.
Do i create an ArrayList and just do a list of 30 customer IDs?
And this is in the customer class?
In the account class i assign a balance (double) to each customer ID?
Is that right?