Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this exercise, you are not provided with a Main)method; you should write fun

ID: 3591795 • Letter: F

Question

For this exercise, you are not provided with a Main)method; you should write functional and will work if only valid data is passed to it. Your task is to take this program and your own to test the modifications you've made to the EnrolmentManager class. Only the Enrolmentmanager class will be tested by AMS. The following is a description of each method in EnrolmentManager, as well as the exceptions that it should throw (but currently doesn't) public EnrolmentManager(int numClasses, int placesPerClass) The constructor sets up enrolment for numClasses classes of up to placesPerClass students each. All of these classes will start out empty. This constructor must throw an ArgumentOutOfRangeException if either parameter is less than or equal to 0 public void EnrolStudent (string studentName, int classNum) This method enrols the student with the name studentName in the class with the code classNum. Classes are indexed starting from 0, so valid class numbers go from 0 to numClasses 1 This constructor must throw an ArgumentoutorRangeException when attempting to enrol a student in an invalid class number, and an ArgumentException when attempting to enrol a student in a class that is already full. public int GetNumClasses() This method returns the number of classes in the EnrolmentManager. It should not throw any exceptions public int GetClasssize() This method returns the maximum number of students that can be enrolled in any class. It should not throw any exceptions. public int GetNumEnrolments(int classNum) This method returns the number of students currently enrolled in the given class This method must throw an ArgumentOutOfRangeException when given an invalid class number. public string GetStudent (int classNum, int studentNum) This method returns the name of student studentNum in class class Num. Both of these values are indexed starting from 0, so Getstudent(e, ) retrieves the first student from the first class; This method must throw an ArgumentOutOfRangeException when given an invalid class number, an ArgumentoutofRangeException when given a negative student number, or an ArgumentException when given a student number that is invalid because there are insufficient students enrolled in the class for that number to be valid public void ListStudents (int classNum) This method prints out a list of all the students in the given class, together with the total number of students in that class. This method must throw an ArgumentOutOfRangeException when given an invalid class number. public int GetFreeClass() This method returns the number of classes in the EnrolmentManager. It should not throw any exceptions.

Explanation / Answer

Hi,

using System.IO;
using System;

class Program
{
static void Main()
{
EnrolmentManager m=new EnrolmentManager(5,10);//creating an object of enrollment manager
m.EnrolStudent("test",2);//enrolling a student named test in course 2
Console.WriteLine("number of classes {0}:",m.GetNumClasses());//printing nunber of total classes
Console.WriteLine("number of student per class {0}:",m.GetNumClassSize());//printing nunber of students per class
Console.WriteLine("number of student enrolled in course 2 {0}:",m.GetNumEnrolments(2));//printing nunber of stundets enrolled in class 2
Console.WriteLine("first student enrolled in course 2 {0}:",m.GetStudent(2,0));//printing first student enrolled in course number 2
Console.WriteLine("All students enrolled in course 2 {0}:",m.ListStudents(2));//printing all students enrolled in course 2
Console.WriteLine("The following class is free {0}:",m.GetFreeClass;//getting the free classes

  
}
}
i have added test execution for every method and added comments to help you understand.

Thumbs up if this was helpful, otherwise let me know in comments

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote