Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Java related question
07-04-2004, 11:08 AM #1
- Join Date
- Jun 2004
- Thanked 0 Times in 0 Posts
Java related question
I hav question relating to JAVA programming. I tried to solve it by my self, but did'nt got it fully correct. So if you can, plz help me. The question is given below:
Write a static Java method named convertDate that takes THREE parameters representing the date, month and year.
The method should first validate the date and month eg. date should be from 1-31 for Jan, March, May, July, August, October and December and ranges from 1- 30 for the other months with the exception of Feb. If a year can be divided by 4, the month of Feb will have 29 days instead of 28 days.
Then convert and return the date as a string in the following format: DD/MM/YYYY short eg. 11/05/2002.
If any of the parameters are invalid the value “Invalid” should be returned.
Above is question which i am trying to solve. I have solved half of it which i am giving below,
public static boolean covertDate( int day,int month,int year)
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
case 4: case 6: case 9: case 11:
} // end switch
} // end main
} // end class dates
Can anyone help me to solve this program. thanks in advance
07-04-2004, 05:56 PM #2
- Join Date
- May 2002
- Marion, IA USA
- Thanked 84 Times in 83 Posts
This looks like a homework assignment. We cannot solve it for you. If you ask specific questions then we can guide you in the write direction but we will not do the homework for you.
CodingForums Supreme Overlord
All Hail Spookster