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.

Computer Science & Information Technology

You might also like to view...

The order in which the data series is plotted on a pie chart is determined by:

A) the alphabetic order of the data labels on the worksheet. B) the order of the data on the worksheet. C) the size of the data on the worksheet. D) None of the above.

Computer Science & Information Technology

Explain what activity information is important for sequencing activities.

What will be an ideal response?

Computer Science & Information Technology