enum with switch case


using System;

 

namespace ConsoleApplication2

{

    class class1

    {

        enum marks { verybad, bad, avg, good, verygood };

 

        public static void Main()

        {

 

            marks priority = marks.verybad;

            string mark = Console.ReadLine();

           

            if (Convert.ToInt32(mark) < 30)

            {

                priority = marks.verybad;

            }

            if (Convert.ToInt32(mark )>= 30 && Convert.ToInt32(mark) < 50)

            {

                priority = marks.bad;

            }

 

            if (Convert.ToInt32(mark )>= 50 && Convert.ToInt32(mark) < 75)

            {

                priority = marks.avg;

            }

            if (Convert.ToInt32(mark) >= 75 && Convert.ToInt32(mark) < 90)

            {

                priority = marks.good;

            }

            if (Convert.ToInt32(mark) >= 90)

            {

                priority = marks.verygood;

            }

 

            Console.WriteLine(IsImportant(priority));

            Console.ReadLine();

 

        }

        static string IsImportant(marks priority)

        {

            switch (priority)

            {

                case marks.verybad:

                    return "varybad";

                  

                case marks.bad:

                    return "bad";

                  

                case marks.avg:

                    return "avg";

                  

                case marks.good:

                    return "good";

                   

                case marks.verygood:

                    return "verygood";

                   

                default:

                    return "xxxxxxxxxx";

                   

            }

        }

    }

}