Answer to Question #256571 in C# for shaves

Question #256571

Create a user defined class for Exception for age, if age is negative throw an exception that age cannot be less than zero?


1
Expert's answer
2021-10-25T14:49:48-0400
using System;
using System.Collections.Generic;


namespace App
{


    class AgeException:Exception{
        public AgeException()
            : base("Age cannot be less than zero")
        {
            
        }
    }




    class Program
    {


        static void Main(string[] args)
        {
          
            
            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS