Question: Can someone please provide code in C# Linq for below problem -------------------------------------------------------------------------- Maximum used policy At the moment, AmSure Insurance Agency distributes exciting Life Insurance

Can someone please provide code in C# Linq for below problem

--------------------------------------------------------------------------

Maximum used policy

At the moment, AmSure Insurance Agency distributes exciting Life Insurance Products, Health Insurance Products and Motor Insurance Products. The company wants to find the policy type that has maximum number of users. Given a CSV file with all the policy details that are availed through Amsure, Write a program to find the policy type which has maximum users using LINQ statements. Create a class Policy which include following attributes,

Data Type Variable Name
int _policyNumber
string _insuranceType
DateTime _startDate
DateTime _renewalDate

Include appropriate Properties as follows. private string _name; public string Name { get { return _name; } set { _name = value; } } Create the policy.csv file which contain the policy details (ie) policy number, insurance type, policy start date and policy renewal date which is separated by comma. Create a program class. Read the policy.csv file and store it into the policy list. Write a LINQ query to find the policy type under which maximum policies are there. Input and Output Format: Input consists of policy.csv file. Output should display the policy type under which maximum policies are there. Sample input and output : Input file policy.csv contain the details as follows, 6435,Home Insurance,01-03-2016,10-07-2017 5234,Health Insurance,12-12-2014,06-01-2019 5614,Health Insurance,02-09-2015,03-11-2019 8575,Motor Insurance,07-11-2011,03-12-2017 8541,Health Insurance,01-11-2015,07-12-2016 4526,Motor Insurance,05-01-2017,13-09-2018 Output : Health Insurance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!