You have created Product class in Lab 1. You need to extend this class and create two derived classes from this class. The derived classes will be DurableProducts (eg: cars, furniture, computers) and NonDurableProducts(Food and Beverages)
The DurableProducts class will have VAT(value added tax) as an additional property. The NonDurableProducts will have ExpiryDate and Discount properties as additional properties.Task 1: Create these two classes by inheriting from the Product class.
Task 2: Override the GetTotalCost () Method in these two classes. For DurableProducts the new total cost will be (Cost + VAT)*Quantity. For NonDurableProducts the new total cost will be (Cost-Discount)*Quantity.Task 3: Create a console application to use these classes. Create a Menu driven application to select the Type of Product. Based on the user selection create the object and accept the details from the user.
Also display the total cost of the Product.
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.
Create a Math Class which contains methods for addition, subtraction, multiplication and division.
Return type of addition and subtraction methods should be void and multiplication and division should return some values.
Task 1: create delegates and call the above functions and use multicast delegates usage
Task 2: using delegate reference call above any one of the method anonymously.
Task 3: remove all the functions addition, subtraction, multiplication and division and call all the methods using lambda expression.
Task 4:Create an dummy event in console based application and call it using a delegate and that delegate should point to one function .Demonstrat how event will call a delegate and how delegate will call a function .
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)