Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Mankind11b
- {
- public class Student : Human
- {
- private string facultyNumber;
- public Student(string firstName, string lastName, string facultyNumber) : base(firstName, lastName)
- {
- FacultyNumber = facultyNumber;
- }
- public string FacultyNumber
- {
- get { return facultyNumber; }
- set {
- if (!(value.Length >= 5 && value.Length <= 10))
- {
- throw new ArgumentException("Invalid faculty number!");
- }
- if (!value.All(Char.IsLetterOrDigit))
- {
- throw new ArgumentException("Invalid faculty number!");
- }
- facultyNumber = value;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment