using System.Runtime.ExceptionServices;
Console.Write("School Name: ");
SchoolNames = Console.ReadLine();
Console.Write("Principle First Name: ");
PrincipleFirstName = Console.ReadLine();
Console.Write("Number of Teachers: ");
NumberOfTeachers = double.Parse(Console.ReadLine());
public School(string schoolNames, string principleFirstName, double numberOfTeachers)
SchoolNames = schoolNames;
PrincipleFirstName = principleFirstName;
NumberOfTeachers = numberOfTeachers;
Console.WriteLine($"At {SchoolNames}, {PrincipleFirstName} is the principal and there are {NumberOfTeachers} teachers.");
public string SchoolNames
public string PrincipleFirstName
return PrincipleFirstName;
PrincipleFirstName = value;
public double NumberOfTeachers
NumberOfTeachers = value;
public static int SchoolCount
static void Main(string[] args)
const int maxSchools = 7;
School[] schools = new School[maxSchools];
if (schoolCount >= maxSchools) throw new Exception();
schools[schoolCount++] = new School("School Number 1", "Roger", 30);
if (schoolCount >= maxSchools) throw new Exception();
schools[schoolCount++] = new School("School Number 2", "Jonathan", 50);
if (schoolCount >= maxSchools) throw new Exception();
schools[schoolCount++] = new School("School Number 3", "William", 20);
if (schoolCount >= maxSchools) throw new Exception();
schools[schoolCount++] = new School("School Number 4", "Jordan", 40);
for (var i = 0; i < schoolCount; i++)
Console.WriteLine($"There are {School.SchoolCount} schools");
Console.WriteLine("Please enter new school info");
var school = new School();
schools[schoolCount++] = school;
if (schoolCount >= maxSchools)
Console.WriteLine("No more schools can be added");