Sunday, December 4, 2011

Object Oriented Programming ...Would you give me your opinion ?

I have tomorrow an interview for my new company , and they sent me an example of the question ... but i've faced a problem with this ... so gimme how can i do it ...


Here is the question ...


___


AA Bank is a bank with around 3000 clients and 25 on site clerks including the bank manager. The bank is open for 5 days a week from 9am-5pm.


Part A


Clients have access to primitive operations, such as:


a) open an account


b) withdraw a given amount of money from the account


c) deposit a given amount of money to the account


d) The customer cannot open account with less than 5 000 Egyptian pounds.


Part B


In addition clients can have a “time deposit” facility:


a) It gives 8.9% interest rate per month


b) Customers can open a deposit of any given value.


c) The interest added to the value will be calculated over a given period (measured in number of months).


Part C


Clients can have a “loan”:


a) Customers can request a loan of any given value


b) The loan will be collected by the bank within 3 years with 7.2% annual interest rate.


c) The system will calculate the required customer installment per year.|||I don't see your question...





If they wanted my opinion about how I would code such a problem, then I would have %26lt;%26lt;interface%26gt;%26gt; AccountAbstractFactory





ConcreteFactoryAccount





%26lt;%26lt;interface%26gt;%26gt;AbstractAccount





class Client interfaces with AccountAbstractFactory


the ConcreteFactory can then make ProductA, ProductB, ProductC


class Clent can also interface with each Product.


The ConcreteFactoryAccount creates Products at runtime using Factory method pattern.





ConcreteFactoryAccount can then be BankA, BankB, BankC, ...





The above is pure Java, without the Persistence, and for that we would require JavaEE with safeguards using transaction layers.

No comments:

Post a Comment