This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
The problems I am having are: I am trying to get the SSN to have a hyphen. I am getting an error on the + sign just on the one line under the return SSN method.
I am also having trouble getting the annual salary to be a decimal. I keep getting an error using the decimal format.
Please TellTheDetails. If you take a look at those compile time errors, you will get pretty much information about how to fix those.
I've not gone through decimal code, because I found SSN code itself pretty weird. There, first thing is - you are calling a getter method, which returns a String, but you are not assigning it to anything. This is the reason for compilation error.
But the most odd part I found was - you are making a recursive call for getter method of SSN! Why is it so? You can directly access the member right? Besides, there is no exit condition, so that method is gonna blow the call stack.
Further to that, you are not doing any validation within getter/setter methods. Even if you get rid of compilation errors and remove recursive calls, you are still assuming that SSN would be always 10 digit. What if someone provides SSN of length 1 during object creation?