/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.time.*;
import java.time.temporal.*;
import java.time.format.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
ZoneId z = ZoneId.of( "America/Montreal" );
LocalDate today = LocalDate.now( z );
DayOfWeek dow = today.getDayOfWeek();
Set<DayOfWeek> weekend = EnumSet.of( DayOfWeek.SATURDAY , DayOfWeek.SUNDAY );
Boolean todayIsWeekend
= weekend.
contains( dow
); DayOfWeek firstDayOfWeek = DayOfWeek.MONDAY ;
LocalDate startOfWeek = null ;
if( todayIsWeekend ) {
startOfWeek = today.with( TemporalAdjusters.next( firstDayOfWeek ) );
} else {
startOfWeek = today.with( TemporalAdjusters.previousOrSame( firstDayOfWeek ) );
}
// Print report.
System.
out.
println( "Today: " + today
); LocalDate ld = startOfWeek ;
int countDaysToPrint = ( DayOfWeek.values().length - weekend.size() );
for( int i = 1 ; i <= countDaysToPrint ; i++ ) {
String dayName
= ld.
getDayOfWeek().
getDisplayName( TextStyle.
FULL ,
Locale.
CANADA_FRENCH ) ; System.
out.
println( ld
+ " " + dayName
); // Set up the next loop.
ld = ld.plusDays( 1 );
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnRpbWUuKjsKaW1wb3J0IGphdmEudGltZS50ZW1wb3JhbC4qOwppbXBvcnQgamF2YS50aW1lLmZvcm1hdC4qOwoKCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhb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