Campbell Ritchie wrote:Why have you got all your class members static?
Have you been through the Java™ Tutorials, because I think you will find lots of useful information there?
Campbell Ritchie wrote:That is bad design, I am afraid. It means you have too much code in the main() method.
Swastik Dey wrote:One problem as per my understanding is your return statement is out side the loop, so it will print only when the loop terminates. You either need some sort of recursive function or the print statement should be inside the loop itself.
Swastik Dey wrote:
What is happening in the above line?
Swastik Dey wrote:What is the reason behind starting from January? Why not start from the 1st of the given month and year itself.
Swastik Dey wrote:Ok..then even things are getting complicated. You can use Calendar, class it would be much easier.
Swastik Dey wrote:What value janFirst contain. Is this fixed value.
Fred Kleinschmidt wrote:Note that it is not necessary for the caller to specify what day January 1 is (not only that, it is just wrong to do so - the caller could easily enter the incorrect day).
Knowing that January 1, 2018 was a Monday, it is not too difficult to deduce what day January 1 is for any specified year.
It is also not necessary to include a parameter that specifies whether it is a leap year (that also allow the caller to make an error).
Many of us believe that one of the things one should never do is write one's own date and time classes. But you are stuck with it.
Victoria Li wrote:. . . . that is a requirement of the assignment.
Swastik Dey wrote:So your requirement is , considering the given value for Jan you have to display the calendar of given month?
Piet Souris wrote:A simple way without calculations is to have a 2D array month, where the first index is the month, and the second index the number of days in that month. So month = new int, month = new int[28/29], et cetera. Then loop through all the months and days, starting with day janFirst.
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database