A program tha accepts insurance policy data, including a policy number; customer
ID: 3624866 • Letter: A
Question
A program tha accepts insurance policy data, including a policy number; customer last name; customer first name; age; premium due month, day, and year; and number of driver accidents in the last three years. If an entered policy number is not between 1000 and 9999 inclusive, set the policy number to 0. If the month is not between 1 and 12 inclusive, or the day is not correct for the month (for example, not between 1 and 31 for January or 1 and 29 for February), set the month, day, and year to 0. Display the policy data after any revisions have been made.
My question stems from the paragraph above but I just need help with creating a pseudocode for the following:
A program that continuously accepts policy holders' data until a sentinel value has been entered, and displays the data for any policy holder over 35 years old.
I have something drafted but I'm not sure it's correct at all. I can't grasp the concept, even after getting help with the flowchart already.
Thank you!
Explanation / Answer
//Header fiels section
#include <iostream>
#include <string>
using namespace std;
int main()
{
int age;
string lname,fname;
int num_accidents;
do{
cout << "Enter policy number:" << endl;
cin >> policy_number;
if (policy_number>=1000 && policy_number<=9999)
{
}
else
{
policy_number =0;
}
//inputting data
cout << "Enter last name" << endl;
cin >> lname;
cout << "Enter first name:" << endl;
cin >> fname;
cout << "Enter age:" << endl;
cin >> age;
cout << "Enter premium Due Day:" << endl;
cin >> day;
cout <<"Enter premium month:" << endl;
cin >> month;
cout << "Enter premiumYear:" << endl;
cin >> Year;
cout << "Enter number of Accidents:" << endl;
cin >> num_accidents;
if (month<=1 && month>=31)
{
month =0;
Year =0;
}
//outputting data
if (age>=35)
{
cout << "First Name:"<<lname << endl;
cout << "Policy Number:"<<policy_number << endl;
cout << day<<"/"<<month<<" /"<<Year << endl;
cout<< "Enter ‘Yes’ to repeat" << endl;
cin>>repeat;
//pause system
system("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.