A) Create a class named InsurancePolicy for a life insurance company. Data membe
ID: 3548268 • Letter: A
Question
A) Create a class named InsurancePolicy for a life insurance company. Data members include a policy number, last name of the policy holder, value of the policy, and annual premium. Member functions include overloaded insertion and extraction operators. Continue to prompt the user for data for InsurancePolicyobjects and write each InsurancePolicy to a data file until the end-of-file is entered.
B) Write a program that reads the InsurancePolicy file and displays InsurancePolicy data on the screen.
Example Output: Example Output:Explanation / Answer
class InsurancePolicy
{
string policy_number;
string lastname;
float value;
float annual_premium;
}
int main()
{
int check;
InsurancePolicy objects[1000];
int check=1;
int iter=0;
while(check!=EOF)
{
cout<<"Enter bla bla bla"<<endl;
cin>> obects[i].policy_number>>obects[i].lastname>>obects[i].value>>objects[i].annual_premium;
cin>>check;
}
}
This is the overall idea. I am not very sure whether this would compile and run, but I am sure you got the concept :)
Cheers!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.