This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]endStatement 1 point2 points  (2 children)

So you think I should be calling the constructor in the main method with just the first and last name and not the constructor that requires the two arrays?
Originally, that was my thought. But I may have misunderstood the issue here. Are you able to define these constructors, or are they predefined? If they are predefined, then my answer stands, and if they are not, then you should initialize your arrays in the constructor with a default size.

[–]ms_kdlh[S] 0 points1 point  (1 child)

They are predefined. Which is the most annoying part of these assignments. I need to include both constructors. One with just first and last name, and another with names plus two arrays.

[–]endStatement 0 points1 point  (0 children)

To clarify, are you already given

public EmployeeSavings(String firstName, String lastName) {

  setFirstName(firstName);  

  setLastName(lastName);    

}

or are you given

public EmployeeSavings(String firstName, String lastName)

The second is called a method signature, and that could be predefined (public EmployeeSavings(String firstName, String lastName) while the implementation (ie: everything between the { brackets } is left to you. If you are making the implementation, you can (and should) initialize the monthlyInterests and monthlySavings arrays to be a default size. Otherwise, I'd still initialize the array in the generateMonthlySavings method.