Question: Can someone please provide C# code in Events,Delegates and Reflection for the below problem. ----------------- Agent-Policy XYZ Assurance wants to categorize the policies based on
Can someone please provide C# code in Events,Delegates and Reflection for the below problem.
-----------------
Agent-Policy
XYZ Assurance wants to categorize the policies based on the agent who sold the policy and the Insurance type. Given an Agent name, display the policies that were sold by that agent. Similarly, print the policies in the given Insurance type. Write a program to do the same. They have a list of few policies and want to update the list with a few more policies.
Create a class named Agent with the following attributes
| Data Type | Variable Name |
| int | _id |
| string | _name |
Include appropriate Properties as follows. private string _name; public string Name { get { return _name; } set { _name = value; } } Include a 2 argument constructor with _id and _name as arguments. Create a class named InsuranceType with the following attributes
| Data Type | Variable Name |
| int | _id |
| string | _type |
Include appropriate properties. Include a 2 argument constructor with _id and _type as arguments. Create a class named Policy with the following attributes
| Data Type | Variable Name |
| int | _id |
| InsuranceType | _insuranceType |
| Agent | _agent |
| double | _premiumPayable |
Include appropriate Properties. Include a 4 argument constructor with _id ,_insuranceType,_agent,_premiumPayable as arguments. Create a class named PolicyBO and include the following method,
| Method Name | Method Description |
| ListPoliciesByAgent(List | The return type of this method is List |
| ListPoliciesByType(List | The return type of this method is List |
Create a class named Program to test the above classes. The collection for Policy class is prepopulated with predefined values, and get n details from the user and add it to the predefined list. Get the policy details as a single string separated by " , " in the order policy id, insuranceType id, insurance type, agent id, agent name, premium payable. Split the input using Split() method, and store the policy details in a list of type Policy. Create a delegate method named AgentPolicyList(List
| PolicyId | InsuranceTypeId | InsuranceType | Agent Id | User | PremiumPayable |
| 2154 | 3158 | Life Insurance | 154 | Jacob | 25000 |
| 3401 | 3548 | Health Insurance | 251 | Daniel | 30000 |
| 2549 | 3154 | Vehicle Insurance | 154 | Jacob | 15000 |
| 3504 | 3158 | Life Insurance | 251 | Daniel | 20000 |
| 2501 | 3548 | Health Insurance | 624 | Andrew | 35000 |
| 2509 | 3154 | Vehicle Insurance | 624 | Andrew | 27000 |
Sample Input and Output : 2 2541,3254,Life Insurance,251,Aiden,20000.50 2571,3846,Health Insurance,154,Joseph,15000 Daniel Policy List PolicyId InsuranceType PremiumPayable 3401 Health Insurance 30000.00 3504 Life Insurance 20000.00 Life Insurance Policy List PolicyId Agent PremiumPayable 2154 Jacob 25000.00 3504 Daniel 20000.00 2541 Aiden 20000.50
--------------------------
Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
