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
2 odpowiedzi
+ 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];
            }
0
Thank you, you the best!



