You have written a wrong function
public String toString(){//to string summerizing all the inputs on output.
return ("The date you have enterd is : " + this.month +", " + this.day+", " + this.year);
}
1) as this.month function prints the integer value
2) you must use setMonth(month) function to print the month....
3) Also i think you have to modify your function of setMonth(month) because its not efficient, because when you are using switch then you can use default statement, there is no need to use if statement here.
Majestics
Practically a Master Poster
621 posts since Jul 2007
Reputation Points: 199
Solved Threads: 49
You use a switch to convert month number to name, which is a pretty clunky way to do it. Better to have an array of 12 Strings ("Jan","Feb" etc) and use the month number as an index to access the correct name.
JamesCherrill
Posting Genius
6,371 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073