public class EnumExample
{
enum Day {SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY };
?
Day day;
?
public EnumExample(Day day)
{
this.day = day;
}
?
public void giveFeedback()
{
switch (day)
{
case MONDAY:
System.out.println("Mondays are bad.");
break;
?
case FRIDAY:
System.out.println("Fridays are better.");
break;
?
case SATURDAY: case SUNDAY:
System.out.println("Weekends are best.");
break;
?
default:
System.out.println("Midweek days are so-so.");
break;
}
}
?
public static void main(String[] args)
{
EnumExample firstDay = new EnumExample(Day.MONDAY);
firstDay.giveFeedback();
EnumExample thirdDay = new EnumExample(Day.WEDNESDAY);
thirdDay.giveFeedback();
EnumExample fifthDay = new EnumExample(Day.FRIDAY);
fifthDay.giveFeedback();
EnumExample sixthDay = new EnumExample(Day.SATURDAY);
sixthDay.giveFeedback();
EnumExample seventhDay = new EnumExample(Day.SUNDAY);
seventhDay.giveFeedback();
}
}
?
Using the above enumeration and code, what will be the output when the program is executed?
What will be an ideal response?
Mondays are bad.Midweek days are so-so.Fridays are better.Weekends are best.Weekends are best.
You might also like to view...
Answer the following statements true (T) or false (F)
1. Changing file permission is one way to protect your files from unauthorized users. 2. The banner command attaches a banner header to each printed report. 3. The chmod command is used to modify the program mode from foreground to background execution. 4. The calendar command shows the system current time and date. 5. The type command indicates if a file is an ordinary file or a directory file.
A Media Controls bar is automatically included in your presentation when you insert your own video but is not inserted when you use videos from a Web site
Indicate whether the statement is true or false
Individual permissions can be set using the ____ program without any programming.
A. policytool B. securityManager C. gc D. policy
Transferring a subfolder to a USB flash drive is called exporting.
Answer the following statement true (T) or false (F)