0

Monthly Roster

Hi, I got the attached code which is working fine. This is just an exemplary code. The purpose of the code is creating a monthly roster, I'm able to make a roster continuous for one month but when it has to continue from the previous month to the current month, it just start over. How do I make it continue? https://code.sololearn.com/ct9IJB0Z952w/?ref=app

28th Nov 2020, 9:28 PM
Sibusiso Mbambo
2 Answers
+ 1
move declaration of theCount to class field, +add static public class CalendarJava { static int theCount = 0; //here public static void main(String[] args) { ... tip2: there are many of if (theCount == 0) { ... if (theCount == 1) { ... use one if() with variables instead of constants: if (theCount < 20) { System.out.print(rosterA[theCount]); roster = rosterA[theCount+1]; }
29th Nov 2020, 12:00 PM
zemiak
0
Thank you, you the best!
29th Nov 2020, 1:08 PM
Sibusiso Mbambo