File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Help with constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with constructors" Watch "Help with constructors" New topic

Help with constructors

Troy Johnson

Joined: Sep 24, 2003
Posts: 20
Hello. I am trying to add two additional constructors, one that takes "the annual interest rate" and "loan amount", and another that takes just the "loan amount" only. I am just a little confused on this and looking for any suggestions. Thanks.

[ October 19, 2003: Message edited by: Troy Johnson ]
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24184

Hi Troy,
Why confused? You've already got a default constructor that calls the 3-argument one with three default arguments. Now make two more constructors that take one and two arguments each, and have them pass their arguments, along with 2 and 1 default parameters, respectively, in the right order, of course, to the three argument one; then Bob's your uncle!

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: Help with constructors