Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In a Visual Studio, create a new project (C# Console Application (.Net Framework)) named YourFirstName_Test1 (where YourFirstName is your first name, such as John_Test1) to

In a Visual Studio, create a new project (C# Console Application (.Net Framework)) named YourFirstName_Test1 (where YourFirstName is your first name, such as John_Test1) to accomplish the following task: Applicant Class (25 points) This class consists of the following members. All the properties have public getters. DriverID: int o An integer property to store Applicant ID number Name: string o A string property to store applicants name Age: int o An int property to store applicants age SpeedingTicket: bool o A boolean property to indicate if applicant has received speeding ticket in past (true) or not (false) DrivingTest: bool o A boolean property to indicate if applicant has taken driving test in past (true) or not (false) Eligible: bool o A boolean property to indicate if applicant is eligible for the isurance (true) or not (false) o This property must have a setter InsuranceAmount: double o A double property to store the insurance amount the applicant would have to pay o This property must have a setter Define the following constructors for this class: Applicant (int ID, string name, int age, bool ticket = false, bool test = false) o This constructor will assign received parameters to the respective class properties o It will also call the function name FindEligibility() which will determine the eligibility and insurance amount. Implement the following methods in the class: Void FindEligibility() o this method must determine the applicants eligibility as per the following criteria and set the Eligible and InsuranceAmount properties accordingly. Page 3 of 6 Age Speeding Ticket Driving Test Eligible Insurance Amount 25 or more True Doesnt matter True 1000 False True 500 Less than 25 True True True 1500 False True True 1000 All other possibilities Doesnt matter Doesnt matter False 0.0 override string ToString() o this method should display all the Applicant details in appropriate format. Officer_Applicant.txt file You are provided with this text file. You are supposed to put this file in the project folder bin Debug folder to use it to read the data from. This text file contains the Applicant information that each insurance officer should help. The file records are structured using CSV (Comma Separated Values) format. The following is the sample record from file: 498,003,Andrew Kim,25,False,True In the record above, 498 indicates insurance officer ID who will be managing Applicant Andrew Kim whos age is 25, doesnt have speeding ticket and have taken driving test. InsuranceOfficer class (45 points) This class consists of the following members. All the properties have public getters and no setters. ID : int o An int property to store ID of each officer ApplicantList : List o This is property holds a list of Applicant objects that the officer will help. Page 4 of 6 Define the following constructors for this class: InsuranceOfficer(int ID) o This constructor will assign received ID parameters to the respective class property o It will initialize the ApplicantList with empty List by default. o It will then open and read file named Officer_Applicant.txt which is provided with this file. o It will read one line at a time and extract all the fields from the records. o If the first field obtained from each file record matches officer ID provided as parameter in constructor, create an object of Applicant class with the help of remaining fields obtained from file record. o Add the created Applicant class object, to the ApplicantList variable. Implement the following methods in the class: void AddApplicant(int ID, string name, int age, bool ticket = false, bool test = false) o this method will create an object of the Applicant class with the help of provided parameters and add the object to ApplicantList. o It should also print the newly created object values void ShowAll() o this method will display all the Applicant details for the current officer. void ShowAll(bool eligibilityStatus) o this method will display all the Applicant details for the current officer if applicants eligibility status matches with the parameter provided to this function. Testing (30 points) To test your application, use the following test function. You may add more details to the function; but do not delete existing content. static void TestInsurance() { Console.WriteLine($"{new string('-', 34)}Insurance Application{new string('-', 35)}"); InsuranceOfficer officer1 = new InsuranceOfficer(729); Page 5 of 6 officer1.ApplicantList.Add(new Applicant(546, "Alex Du", 19, true, false)); officer1.ShowAll(); officer1.AddApplicant(921, "Dolly Lively", 27, false, false); officer1.ShowAll(); officer1.ShowAll(true); InsuranceOfficer officer2 = new InsuranceOfficer(498); officer2.ApplicantList.Add(new Applicant(576, "Dale", 45, false, true)); officer2.ShowAll(); officer2.AddApplicant(847, "Jack Gibbs", 18, false, false); officer2.ShowAll(); officer2.ShowAll(false); Console.WriteLine($"{new string('-', 90)}"); } Sample output on the next page

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions