public void validateRequest(string request){
if (request.Any(char.IsDigit) || (request.IndexOfAny(new char[] { '*', '&', '#', ',', '!', '?' }) != -1)){
throw (new MyValidatorException("Ime ne moze sadrzati broj ili karakter"));
public void validateForStudent(int valStudent){
throw (new NoStudentException("Error, ne postoji takav student"));
public class MyValidatorException:Exception{
public MyValidatorException(string message): base(message) {
public class NoStudentException:Exception{
public NoStudentException (string message): base(message){
public Student(string oneStudent, string oneAcademy, string oneGroup){
public static void Main()
Student[] grupa = new Student[5];
Student prvi = new Student("Milos","SEDC","1.");
Student drugi = new Student("Dragan","SEDC1","2.");
Student treci = new Student("Petar","SEDC2","3.");
Student cetvrti = new Student("Marko","SEDC1","4.");
Student peti = new Student("Ivan","SEDC3","5.");
Console.WriteLine(grupa[0].Name);
Console.WriteLine("Unesite zeljeno ime:");
string unos = Console.ReadLine();
Validator provera = new Validator();
provera.validateRequest(unos);
foreach (Student ime in grupa){
Console.WriteLine("Postoji na {0}. mestu", i);
provera.validateForStudent(check);
catch (MyValidatorException ex){
Console.WriteLine(ex.Message);
catch (NoStudentException exForStudent){
Console.WriteLine(exForStudent.Message);