5. The Drive-Rite Insurance Company provides automobile insurance policies for d
ID: 3567250 • Letter: 5
Question
5. The Drive-Rite Insurance Company provides automobile
insurance policies for drivers. Design a flowchart or pseudo-code for the following:
a. A program that 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.
b. A program that continuously accepts policy holders
Explanation / Answer
a)
Pseudocode:
start
Declarations
num policyNum
string custLastName
string custFirstName
num age
num duemonth
num duedate
num dueyear
num accidents
output”Enter policy number ”
input policyNum
if policyNum >= 1000 AND policyNum <=9999
policyNum = 0
else
output”Customer Last Name”
input custLastName
output”Customer First Name”
input custFirstName
output”Enter customer age”
input age
output”Enter a due date”
input duedate
output”Enter a due year”
output “Enter due month ”
input duemonth
if duemonth <1 AND duemonth >31 then
duemonth = 0;
dueday = 0;
dueyear = 0
else
output”Enter number of accidents in last three years”
input accidents
output “Policy Number “,policyNum,”Policy holder name”, custFirstName,
custLastName,”Policy holder age”,age,
”policy due”,duemonth,duedate,dueyear,
”Number of acciedents in last three years”, accidents
stop
-----------------------------------------------------------------------------------------------------------
b)
start
Declarations
num policyNum
string custLastName
string custFirstName
num age
num duemonth
num duedate
num dueyear
num accidents
while policyNum <> 0
output”Enter policy number ”
input policyNum
if policyNum >= 1000 AND policyNum <=9999 then
policyNum = 0
else
output”Customer Last Name”
input custLastName
output”Customer First Name”
input custFirstName
output”Enter customer age”
input age
output”Enter a due date”
input duedate
output”Enter a due year”
output “Enter due month ”
input duemonth
if duemonth <1 AND duemonth >31 then
duemonth = 0;
dueday = 0;
dueyear = 0
else
output”Enter number of accidents in last three years”
input accidents
endwhile
if age <=35 then
output “Policy Number “,policyNum,”Policy holder name”, custFirstName, custLastName,”Policy holder age”,age,”policy due”,duemonth,duedate,dueyear,”Number of acciedents in last three years”, accidents
end if
stop
----------------------------------------------------------------------------------------------------------------------------------------------
c)
starts
Declartions
num policyNum
string custLastName
string custFirstName
num age
num duemonth
num duedate
num dueyear
num accidents
output”Enter policy number ”
input policyNum
if policyNum >= 1000 AND policyNum <=9999 then
policyNum = 0
else
output”Customer Last Name”
input custLastName
output”Customer First Name”
input custFirstName
output”Enter customer age”
input age
output”Enter a due date”
input duedate
output”Enter a due year”
output “Enter due month ”
input duemonth
if duemonth >=1 AND duemonth <=31 then
duemonth = 0;
dueday = 0;
dueyear = 0
else
output”Enter number of accidents in last three years”
input accidents
if age =21 then
output “Policy Number “,policyNum,”Policy holder name”, custFirstName, custLastName,”Policy holder age”,age,”policy due”, duemonth,
duedate,dueyear, ”Number of acciedents in last three years”, accidents
else output “No data”
stop
---------------------------------------------------------------------------------------------------------------------------------------
4)
start
Declarations
num policyNum
string custLastName
string custFirstName
num age
num duemonth
num duedate
num dueyear
num accidents
output”Enter policy number ”
input policyNum
if policyNum >= 1000 AND policyNum <=9999 then
policyNum = 0
else
output”Customer Last Name”
input custLastName
output”Customer First Name”
input custFirstName
output”Enter customer age”
input age
output”Enter a due date”
input duedate
output”Enter a due year”
output “Enter due month ”
input duemonth
if duemonth >=1 AND duemonth <=31 then
duemonth = 0;
dueday = 0;
dueyear = 0
else
output”Enter number of accidents in last three years”
input accidents
if age >=30 then
output “Policy Number “,policyNum,”Policy holder name”, custFirstName, custLastName,”Policy holder age”,age,”policy due”,duemonth,duedate,dueyear,”Number of acciedents in last three years”, accidents
else
output “No data”
stop
---------------------------------------------------------------------------------------------------------------------------------------------
5)
start
Declartions
num policyNum
string custLastName
string custFirstName
num age
num duemonth
num duedate
num dueyear
num accidents
output”Enter policy number ”
input policyNum
if policyNum >= 1000 AND policyNum <=9999 then
policyNum = 0
else
output”Customer Last Name”
input custLastName
output”Customer First Name”
input custFirstName
output”Enter customer age”
input age
output”Enter a due date”
input duedate
output”Enter a due year”
output “Enter due month ”
input duemonth
if duemonth >=1 AND duemonth <=31 then
duemonth = 0;
dueday = 0;
dueyear = 0
else
output”Enter number of accidents in last three years”
input accidents
if duemonth >=3 AND dueday >=15
output “Policy Number “,policyNum,”Policy holder name”, custFirstName, custLastName,”Policy holder age”,age,”policy due”,duemonth,duedate,dueyear,”Number of acciedents in last three years”, accidents
endif
else output”No data”
stop
----------------------------------------------------------------------------------------------------------------------------------------
6)
starts
Declartions
num policyNum
string custLastName
string custFirstName
num age
num duemonth
num duedate
num dueyear
num accidents
output”Enter policy number ”
input policyNum
if policyNum >= 1000 AND policyNum <=9999 then
policyNum = 0
else
output”Customer Last Name”
input custLastName
output”Customer First Name”
input custFirstName
output”Enter customer age”
input age
output”Enter a due date”
input duedate
output”Enter a due year”
output “Enter due month ”
input duemonth
if duemonth >=1 AND duemonth <=31 then
duemonth = 0;
dueday = 0;
dueyear = 0
else
output”Enter number of accidents in last three years”
input accidents
if duemonth =1 AND dueday =1 AND dueyear = 2012
output “Policy Number “,policyNum,”Policy holder name”, custFirstName, custLastName,”Policy holder age”,age,”policy due”,duemonth,duedate,dueyear,”Number of acciedents in last three years”, accidents
endif
else output”No data”
stop
--------------------------------------------------------------------------------------------------------------------------------------
7)
start
Declaration
num policyNum
string custLastName
string custFirstName
num age
num duemonth
num duedate
num dueyear
num accidents
output”Enter policy number ”
input policyNum
if policyNum >= 1000 AND policyNum <=9999 then
policyNum = 0
else
output”Customer Last Name”
input custLastName
output”Customer First Name”
input custFirstName
output”Enter customer age”
input age
output”Enter a due date”
input duedate
output”Enter a due year”
output “Enter due month ”
input duemonth
if duemonth >=1 AND duemonth <=31 then
duemonth = 0;
dueday = 0;
dueyear = 0
else
output”Enter number of accidents in last three years”
input accidents
if duemonth =4 AND dueday =27 AND dueyear = 2011
output “Policy Number “,policyNum,”Policy holder name”, custFirstName, custLastName,”Policy holder age”,age,”policy due”,duemonth,duedate,dueyear,”Number of acciedents in last three years”, accidents
endif
else output”No data”
stop
-----------------------------------------------------------------------------------------------------------------------
8)
start
Declarations
num policyNum
string custLastName
string custFirstName
num age
num duemonth
num duedate
num dueyear
num accidents
output”Enter policy number ”
input policyNum
if policyNum >= 1000 AND policyNum <=9999 then
policyNum = 0
else
output”Customer Last Name”
input custLastName
output”Customer First Name”
input custFirstName
output”Enter customer age”
input age
output”Enter a due date”
input duedate
output”Enter a due year”
output “Enter due month ”
input duemonth
if duemonth >=1 AND duemonth <=31 then
duemonth = 0;
dueday = 0;
dueyear = 0
else
output”Enter number of accidents in last three years”
input accidents
if policyNum >=1000 AND policyNum = 4000
if duemonth =4 OR duemonth =5 AND accidents >=3
output “Policy Number “,policyNum,”Policy holder name”, custFirstName, custLastName,”Policy holder age”,age,”policy due”,duemonth,duedate,dueyear,”Number of acciedents in last three years”, accidents
endif
endif
else output”No data”
stop
------------------------------------------------------------------------------------------------------------------------
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.