Question: I ' m so stuck, please help... Thanks so much in advance!! I can't figure out what to delete out of my old code and
Im so stuck, please help... Thanks so much in advance!!
I can't figure out what to delete out of my old code and replace it with the new code. I thought i knew but when i tried to add the new code, the days of the week didnt show up on my calendar.
Here is my new code but I can't get it to work because I have no idea which sections I need to delete out of the old code.
Array to hold the names of the days of the week
public static final String dayNames Sun "Mon", "Tue", "Wed", "Thu", "Fri", "Sat";
Method to populate the calendar array with day numbers
public static void populateCalendarArrayint calendarDays
int day ;
for int week ; week calendarDays.length; week
for int dayOfWeek ; dayOfWeek calendarDaysweeklength; dayOfWeek
if day
calendarDaysweekdayOfWeek day;
else
calendarDaysweekdayOfWeek; Placeholder for days not in the month
Method to print the calendar
public static void printCalendarint calendarDays
Print the header using the dayNames array
for String dayName : dayNames
System.out.printdayName t;
System.out.println;
Print the days of the month
for int week : calendarDays
for int day : week
if day
System.out.printt; Placeholder for empty days
else
System.out.printday t;
System.out.println;
public static void mainString args
Create a D array to represent the calendar days
int calendarDays new int; weeks, days per week
Populate the calendar with day numbers
populateCalendarArraycalendarDays;
Print the calendar
printCalendarcalendarDays;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
