Question: #Create a program that will prepare automobile liability insurance estimates #for customers. def main(): #Get name and age name = input(Enter the name of the

#Create a program that will prepare automobile liability insurance estimates #for customers.

def main():

#Get name and age name = input("Enter the name of the customer:") age = int(input("Enter the age of the customer:")) # make sure customer is in right age group if age <16 or age>105: # if the user is less than 16 or greater than 105 = invalid print("Invalid Entry") else: #get number of traffic violations number_of_traffic_violations = int(input("Enter the number of traffic" + \ " violations:")) riskCode,riskType = calRisk(name,age,number_of_traffic_violations) insurancePrice = calinsurancePrice(name,age,number_of_traffic_violations,riskType,riskCode) display_quote(name,riskType,insurancePrice)

#calculate risktype def calRisk(name,age,number_of_traffic_violations): if number_of_traffic_violations >= 4: riskCode = 1 riskType = 'high' elif number_of_traffic_violations == 3: riskCode = 2 riskType = 'moderate' elif number_of_traffic_violations == 2: riskCode = 3 riskType = 'moderate' elif number_of_traffic_violations == 1: riskCode = 4 riskType = 'low' elif number_of_traffic_violations == 0: riskCode = 5 riskType = 'no' return riskCode , riskType #calculate price def calinsurancePrice(name,age,number_of_traffic_tickets,riskCode,riskType): insurancePrice = 0

if age < 25 and number_of_traffic_tickets >= 4 and riskCode == 1: insurancePrice = 480 elif age >= 25 and number_of_traffic_tickets >= 4 and riskCode == 1: insurancePrice = 410 elif age <= 24 and number_of_traffic_tickets == 3 and riskCode == 2: insurancePrice = 450 elif age >= 25 and number_of_traffic_tickets == 3 and riskCode == 2: insurancePrice = 390 elif age <= 24 and number_of_traffic_tickets == 2 and riskCode == 2: insurancePrice = 405 elif age >= 25 and number_of_traffic_tickets == 2 and riskCode == 2: insuranscePrice = 365 elif age <= 24 and number_of_traffic_tickets == 1 and riskCode == 3: insurancePrice = 380 elif age >= 25 and number_of_traffic_tickets == 1 and riskCode == 3: insurancePrice = 315 elif age <= 24 and number_of_traffic_tickets == 0 and riskCode == 4: insurancePrice = 325 elif age >= 25 and number_of_traffic_tickets == 0 and riskCode == 4: insurancePrice = 275 return insurancePrice

#display output def display_quote(name,riskType,insurancePrice): # print insurance quote print(name,",as a",riskType,"risk driver, your insurance will cost ${:.2f}".format(insurancePrice))

main()

My program works perfect except for the cost. It states risk driver you insurance will cost $

#Create a program that will prepare automobile liability insurance estimates #for customers.

def main():

#Get name and age name = input("Enter the name of the customer:") age = int(input("Enter the age of the customer:")) # make sure customer is in right age group if age <16 or age>105: # if the user is less than 16 or greater than 105 = invalid print("Invalid Entry") else: #get number of traffic violations number_of_traffic_violations = int(input("Enter the number of traffic" + \ " violations:")) riskCode,riskType = calRisk(name,age,number_of_traffic_violations) insurancePrice = calinsurancePrice(name,age,number_of_traffic_violations,riskType,riskCode) display_quote(name,riskType,insurancePrice)

#calculate risktype def calRisk(name,age,number_of_traffic_violations): if number_of_traffic_violations >= 4: riskCode = 1 riskType = 'high' elif number_of_traffic_violations == 3: riskCode = 2 riskType = 'moderate' elif number_of_traffic_violations == 2: riskCode = 3 riskType = 'moderate' elif number_of_traffic_violations == 1: riskCode = 4 riskType = 'low' elif number_of_traffic_violations == 0: riskCode = 5 riskType = 'no' return riskCode , riskType #calculate price def calinsurancePrice(name,age,number_of_traffic_tickets,riskCode,riskType): insurancePrice = 0

if age < 25 and number_of_traffic_tickets >= 4 and riskCode == 1: insurancePrice = 480 elif age >= 25 and number_of_traffic_tickets >= 4 and riskCode == 1: insurancePrice = 410 elif age <= 24 and number_of_traffic_tickets == 3 and riskCode == 2: insurancePrice = 450 elif age >= 25 and number_of_traffic_tickets == 3 and riskCode == 2: insurancePrice = 390 elif age <= 24 and number_of_traffic_tickets == 2 and riskCode == 2: insurancePrice = 405 elif age >= 25 and number_of_traffic_tickets == 2 and riskCode == 2: insuranscePrice = 365 elif age <= 24 and number_of_traffic_tickets == 1 and riskCode == 3: insurancePrice = 380 elif age >= 25 and number_of_traffic_tickets == 1 and riskCode == 3: insurancePrice = 315 elif age <= 24 and number_of_traffic_tickets == 0 and riskCode == 4: insurancePrice = 325 elif age >= 25 and number_of_traffic_tickets == 0 and riskCode == 4: insurancePrice = 275 return insurancePrice

#display output def display_quote(name,riskType,insurancePrice): # print insurance quote print(name,",as a",riskType,"risk driver, your insurance will cost ${:.2f}".format(insurancePrice))

main()

I need help, my program works perfectly except the print insurance quote. It says as a risk driver your insurance will cost $0.00 for every risktype.. What did I do wrong??? I've looked and looked and I can't find the error. Thanks!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!