3.2. The Loan Enterprise Bean

Ok, interest rates have fallen and it's time to refinance that loan you've been thinking about. How much should you borrow and for how many years? What would your new monthly payment be?

Let's design a Loan enterprise bean that provides methods to calculate long-term fixed rate loans, such as home loans. Our Loan EJB will have three business methods. The first method returns the monthly payment (principal and interest) one must pay given the loan amount, annual interest rate, and term (the length of the loan in years). The second method produces an amortization table providing a month-by-month payment schedule of the loan. A third method produces a year-by-year payment schedule.

In presenting this example, we'll ...

Get Enterprise JavaBeans™ Component Architecture: Designing and Coding Enterprise Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.