Question: Modify the Demo class to read information about a set of Insurance Policies from a text file ( named Policylnformation.txt ) instead of asking the
Modify the Demo class to read information about a set of Insurance Policies from a text file named Policylnformation.txt instead of asking the user for input. The text file contains information in the following order:
Policy Number
Provider Name
Policyholder's First Name
Policyholder's Last Name
Policyholder's Age
Policyholder's Smoking Status will be "smoker" or "nonsmoker"
Policyholder's Height in inches
Policyholder's Weight in pounds
The program should create Policy objects for each of the policies contained in the file, and should be able to handle a file of any size.
The Policy objects should be stored in a structure that can automatically adjust to accommodate the number of objects being stored in itHint: Review Chapter
GitHub Desktop Commit: Commit your changes to your Project branch with the description "Modified to read input from a file".
Step
The demo program should display the same information as the output in Project for each of the Policy objects by iterating over the structure that the Policy objects are being stored in
Step
The demo program should display the number of Policyholders that are smokers and the number of Policyholders that are nonsmokers.
GitHub Desktop Commit: Commit your changes to the Project branch with the description: "Added code to display all policy information the number of smokers, and the number of nonsmokers".
After committing the last changes to the Project branch, make sure to merge the changes into the main branch and push them to the remote repository follow the same procedure that was explained in Project Submit a screenshot of your remote GitHub repository follow the same
Submit a screenshot of your remote GitHub repository follow the same procedure that was explained in Project
Sample Output
Policy Number:
Provider Name: State Farm
Policyholder's First Name: Alice
Policyholder's Last Name: Jones
Policyholder's Age:
Policyholder's Smoking Status smokernonsmoker: smoker
Policyholder's Height: inches
Policyholder's Weight: pounds
Policyholder's BMI:
Policy Price: $
Policy Number:
Policy Number:
Provider Name: Aetna
Policyholder's First Name: Bob
Policyholder's Last Name: Lee
Policyholder's Age:
Policyholder's Smoking Status smokernonsmoker: nonsmoker
Policyholder's Height: inches
Policyholder's Weight: pounds
Policyholder's BMI:
Policy Price: $
Policy Number:
Provider Name: Met Life
Policyholder's First. Name: Chester
Policyholder's Last Name: Williams
Policyholder's Age:
Policyholder's Smoking Status smokernonsmoker: smoker
Policyholder's Height: inches
Policyholder's Weight: pounds
Policyholder's BMI:
Policy Price: $
Policy Number:
Provider Name: Global
Policyholder's First Name: Cindy
Policyholder's Last Name: Smith
Policyholder's Age:
Policyholder's Smoking Status smokernonsmoker: nonsmoker
Policyholder's Height: inches
Policyholder's Weight: pounds
Policyholder's BMI:
Policy Price: $
Policy Number:
Provider Name: Reliable
Policyholder's First Name: Jenna
Policyholder's Last Name: Lewis
Policyholder's Age:
Policyholder's Smoking Status smokernonsmoker: smoker
Policyholder's Height: inches
Policyholder's Weight: pounds
Policyholder's BMI:
Policy Price: $
Policy Number:
Policy Number:
Provider Name: State Farm
Policyholder's First Name: Craig
Policyholder's Last Name: Duncan
Policyholder's Age:
Policyholder's Smoking Status smokernonsmoker: smoker
Policyholder's Height: inches
Policyholder's Weight: pounds
Policyholder's BMI:
Policy Price: $
The number of policies with a smoker is:
The number of policies with a nonsmoker is:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
