Hi,
I made this code for a home work exercise that uses a switch statement to choose the correct number of days in a month. This is so I can use it to return the number of days between two dates. However, my code is not working and I don't know why.
Thanks,Code:public class Year { protected int daysinyear; protected int daysLapsed; protected int month; protected int days; public Year (){ daysinyear = 365; month = 3; } public date checkmonth (month){ switch (month) { case 1: return days =31; case 2: return days =28; case 3: return days =31; case 4: return days =30; case 5: return days =31; case 6: return days =30; case 7: return days =31; case 8: return days =31; case 9: return days =30; case 10: return days =31; case 11: return days =30; case 12: return days =31; } }
Nightwalker




Reply With Quote