Q:

Create an enumeration named Month that holds values for the months of the year, starting with JANUARY equal to 1. Write a program named MonthNames that prompts the user for a month integer. Convert the user’s entry to a Month value, and display it

0

Create an enumeration named Month that holds values for the months of the year, starting with JANUARY equal to 1. Write a program named MonthNames that prompts the user for a month integer. Convert the user’s entry to a Month value, and display it.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;

namespace MonthNames
{
    class MonthNames
    {
        enum Month
        {
            JANUARY = 1, FEBRUARY, MARCH, APRIL,
            MAY, JUNE, JULY, AUGUST,
            SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER
        }
        static void Main(string[] args)
        {
            WriteLine("MonthNames");

            Month inputNum = (Month) int.Parse(ReadLine());

            WriteLine("{0} is {1}", (int)inputNum, inputNum);


            WriteLine("--End--");
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now