Tasks 1. Open a new Maple worksheet and type the commands in the left-hand colum
ID: 3592241 • Letter: T
Question
Tasks 1. Open a new Maple worksheet and type the commands in the left-hand column below into it. These -cos commands will help you estimate lim- a command line -such as either of the do-loops below -into multiple lines as shown by holding down the Shift key before you hit the Enter key. On a Macintosh you can do the same thing by holding down the Shift or Option key before you hit the Return key. On the other hand, it's also acceptable to just type "for n from 1 to 6 do end do:" on one line.) numerically, if it exists. (Note On a PC you can break > # Your name, today's date > # Guessing Limits Numerically > restart; >fx (1-cos(x))/x"2 > plot (f (x),x-1..1) > fCO); > for n from 1 to 6 Clear Maple's memory Let f(x) (1 cos)2 Plot the graph of f for e-1,1. What is f(0)? Let's look at some values of f(x) for z >0. This is the beginning of a "do loop" Let=1/2° Print the values of z and f(x). This is the end of the "do loop". Now let's look at some values of f(x) for a for n from 1 to 6 do print (evalf(x), end do: evalf (f (x))); At this time make a hard copy of your typed input and Maple's responses. Then: 2. On the graphie you created in Task 1, plot the points on the graph of f whose y values you computed in the two "do loops". (The easiest way to do this is to plotvalues along the z-axis and then draw lines parallel to the y-axis through these points, until they meet the graph of f) 1 COSE exists 3. On the basis of the data you produced in Task 1, do you think lim- you think it is to 4 decimal places of accuracy? Justify your answer exists? If so, what doExplanation / Answer
it's C sharp( read the instruction carefully before starting) For this task you are provided with an EnrolmentManager class. The class is fully functional and will work if only valid data is passed to it. Your task is to take this program and make it throw some useful exceptions in those cases. 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 ArgumentOutOfRangeException 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 classNum. Both of these values are indexed starting from 0, so GetStudent(0, 0) 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. For this exercise, you are not provided with a Main() method; you should write your own to test the modifications you've made to the EnrolmentManager class. Only the Enrolmentmanager class will be tested by AMS. (BELOW GIVEN CODES, ALSO NEED TO CREATE MAIN METHOD) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Enrolment { public class EnrolmentManager { private List[] classes; private int maxClassSize; public EnrolmentManager(int numClasses, int placesPerClass) { classes = new List[numClasses]; for (int classNum = 0; classNum < numClasses; classNum++) { classes[classNum] = new List(placesPerClass); } maxClassSize = placesPerClass; } public void EnrolStudent(string studentName, int classNum) { classes[classNum].Add(studentName); } public int GetNumClasses() { return classes.Length; } public int GetClassSize() { return maxClassSize; } public int GetNumEnrolments(int classNum) { return classes[classNum].Count; } public string GetStudent(int classNum, int studentNum) { return classes[classNum][studentNum]; } public void ListStudents(int classNum) { Console.WriteLine("Students in class {0}:", classNum); foreach (string studentName in classes[classNum]) { Console.WriteLine("- {0}", studentName); } Console.WriteLine("Total of {0} students.", classes[classNum].Count); } public int GetFreeClass() { for (int classNum = 0; classNum < classes.Length; classNum++) { if (classes[classNum].Count < maxClassSize) { return classNum; } } return -1; } } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.