Month class

Hi All! Here is the exercise which asks to transform numbers from 1 to 12 into the corresponding month names january, feb and etc. Need to implement class whose constructor parameter is the month number and whose getName method returns the month name. It also gives hint: Make a very long string "January February....", in which you add spaces such that each month name has the same length.Then use substring to extract the month you want.

Re: Month class

Re: Month class

It looks like this is an exercise in loops. The first thing you should do is fix your month string. Since "September" is the largest name, you have to pad your month names to 9 spaces: "January February March April May ...