In the application class (Program.cs), do the following:
Implement the following methods:
static void addRecipient(RecipientList List)
// Requests the name of the student and adds that student to the List
// You may assume that all students are added as Recipients starting with 90 hours
static void updateHours(RecipientList List)
// Requests the name of the student as well as the number of hours worked
// It then updates the hours left
Implement the main method which does the following:
Ask the user for the number of recipients’ details that needs to be recorded (you can assume
a valid number between 1 and 10).
Use a loop to obtain the required details from the user (uses addRecipient()).
Allows the user to update the number of hours for a single student (uses updateHours())
Displays all the student details from the list
Q1) write generic functions to add, multiply, subtract and divide any kind of data type’s integer, double, decimal and date types.
Q2) write a generic class to implement same above functionalities in your program.
This question follow the ones last posted:
Open and edit your console application to use a List Class instead (called RecipientList). Update the Recipient class to include the following method: public void updateHours(int H) //update the hours left – //If a student has worked H hours in the department, the number of hours should decrease by H //It is also possible that number of hours can be increased The List Class should declare the list as an array of 10 Recipient objects, and should contain the following methods: public void Add(Recipient addNew) //adds a new recipient to the list (if list is full, an error message is displayed public int Count() //returns the number of objects in the list public void Display() //Displays all the recipients in the list public int Find(string Wanted) //returns the position of the wanted element in the list private int LinearSearch(string Wanted)
Create a console application for the department to record information for students who receive bursaries in the department. For each recipient you need to store the recipient’s name and the number of hours outstanding. Most new recipients start with 90 hours, but there are some exceptions. As recipients works in the department, the number of hours left needs to be updated (decreased) from time to time, based on hours already worked. Implement class Recipient which has private attributes for Name and Hours. Create two constructors, one with a default allocation of 90 hours for a recipient, and the other should accept the number of hours for a recipient. In addition to the constructors, the class should have the following methods: public string getName() //Returns the name of the recipient public int getHours() //Returns the hours outstanding public void setHours(int H) //Set the hours outstanding public void displayRecipient() //Display the name and number of hours left for a recipient
This question continues with this one posted now:
In the application class (main method), do the following Implement method addMember(): static void addMember(Member[] memberList, ref int nrEl) //Request the name of a member and adds that member to the list Implement the main method which contains the following: A declaration of an array of members, which can take 5 members A loop that adds 5 members to the array, using addMember() A loop that sets the points of the first two members to 30 A call to an array method to sort the objects in the array in ascending order of name A loop that uses displayMember() to display all the objects