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
696 posts since Jul 2007
Reputation Points: 209
Solved Threads: 66
Skill Endorsements: 5
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
... trying to help
8,516 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30