Part 4: Auto Insurance Premiun Calculator (10 points) Comlete the function auto insurance, which computes and returns th

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Part 4: Auto Insurance Premiun Calculator (10 points) Comlete the function auto insurance, which computes and returns th

Post by answerhappygod »

Part 4 Auto Insurance Premiun Calculator 10 Points Comlete The Function Auto Insurance Which Computes And Returns Th 1
Part 4 Auto Insurance Premiun Calculator 10 Points Comlete The Function Auto Insurance Which Computes And Returns Th 1 (506.15 KiB) Viewed 37 times
Part 4: Auto Insurance Premiun Calculator (10 points) Comlete the function auto insurance, which computes and returns the auto insurance premium for someone, based on that person's age and driving history. The function takes the following arguments, in this order: • premium: a floating-point number that represents the normal (base) cost of a particular auto insurance policy age: a positive integer that represents a person's age • history: a string that can be either 'good' or 'poor' and returns the floating-point premium the user has to pay. The following policies are applied: • if age is between 18 (inclusive) and 21 (exclusive) and history is 'poor', then 100% of the premium must be paid. • if age is between 18 (inclusive) and 21 (exclusive) and history is 'good', then 90% of the premium must be paid. • if age is between 21 (inclusive) and 30 (exclusive), regardless of history, then 75% of the premium must be paid. ● if age is between 30 (inclusive) and 60 (exclusive) and history is 'good', then 60% of the premium must be paid. • if age is between 30 (inclusive) and 60 (exclusive) and history is 'poor', then 70% of the premium must be paid. • if age is at least 60, regardless of driving history, 100% of the premium must be paid. You may assume that the input is always valid. Hint: You should use nested if-statements to implement the "and" rules described above. Examples: Function Call Return Value auto insurance (150.0, 20, 'poor') 150.0 135.0 auto insurance (150.0, 20, 'good') auto insurance (200.0, 28, 'poor') 150.0 auto insurance (200.0, 29, 'good') 150.0 auto insurance (300.0, 42, 'poor') 210.0 auto insurance (300.0, 51, 'good') 180.0 auto insurance (250.0, 72, 'poor') 250.0 auto insurance (300.0, 25, 'poor') 225.0 auto insurance (300.0, 51, 'good') 180.0
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply