Examlex

Solved

Public Class EnumExample

question 54

Essay

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?


Definitions:

Short Run

A period in economics during which some factors of production are fixed, limiting the ability to fully adjust to market changes.

Elasticity of Market Supply

The degree to which the quantity supplied of a good changes in response to a change in price.

Output Expansion

The increase in the production of goods and services in an economy or by a firm, often as a result of increased demand or improved production capabilities.

Period Lengthened

The extension of time allocated for a particular activity, phase, or process.

Related Questions