ABC Corp wants to maintain list of Customers. While accepting the data, you need to validate CreditLimit property. If the value is invalid, you need to raise Exception. We need to implement custom exception class to implement the same.
using System;
namespace ABC_corp
{
internal class Program
{
public static void Main(string[] args)
{
Console.WriteLine("ABC Corporation...\n");
Console.Write("Enter a CreditLimits: ");
int limits = int.Parse(Console.ReadLine());
Console.Write("Enter a list of clients: ");
int n = int.Parse(Console.ReadLine());
if (n > limits)
{
Console.Write("\nValue is invalid");
throw new Exception("Value is invalid");
}
else
Console.Write("Admissible");
Console.ReadLine();
}
}
}
Comments
Leave a comment