Hi,
thanks for the welcome. I hope you can help me with ,y java pursuit.
I am trying to create a class Date which will eventually contains a single method called showMonth() which will display a calendar for a particular month in the following format (
JanuarySMTWTFS 12345678910111213141516171819202122232425262728293031
I am trying to pass the following parameters
String monthName; // e.g. January
int daysInMonth; // e.g. 31
int dayOfWeek; // day of the week (1-7)
// that the month starts
// assuming that Sunday is 1
To display the above I have a runIt() method in the DateDemo class which asks the user for (monthName, numOfDays, startDay) and then calls showMonth(monthName, numOfDays, startDay)
e.g. “January”, 31, 3.
But at the moment all I am getting is numbers 1 to 49 (7 * 7 = 7 rows by 7 columns) in a 7 * 7 block.
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35
36 37 38 39 40 41 42
43 44 45 46 47 48 49
Eventually I will use the code below to create the method.
int count =1;
for (int row = 1; row <= 7; row++)
{
for (int col = 1; col <= 7; col++)
{
System.out.print(count + "\t");
count++;
}
System.out.println();
}
}
can you point me in the right direction please