Info
Warning
Danger
/ Homework Answers / Computer Science / Question Description The purpose of this challenge to use overloaded functions with

Question : Question Description The purpose of this challenge to use overloaded functions with

Question

Description

The purpose of this challenge is to use overloaded functions with default parameters. This functions simulates an insurance application calculator for life and auto.

Requirements

Write a function double calc_premium(int gender, int age, bool smoker = false). This function is used to calculate life insurance monthly premium. This function sets a base premium of 50.00 in the function. If the gender is 1 (male), add 25. If the gender is 2, don’t change the premium. If the age < 25, add 50. If the age > 55, add 30. If smoker is true, double the premium after factoring in gender and age.

Write an overloaded function double calc_premium(int year). This function (note the same name) is used to calculate auto insurance. Set a base rate of $33 in the function. If year < 2010, set premium to 1.25% of the base rate. If the year >= 2010, set premium to 0.95 of the base rate.

In main, call the above functions in various ways making sure to test all variations.

Sample main()

 

Solution
5 (1 Ratings )

Solved
Computer Science 7 Months Ago 6 Views
This Question has Been Answered!
Premium Content -

Unlimited Access

Explore More than 2 Million+
  • Textbook Solutions
  • Flashcards
  • Homework Answers
  • Documents
Signup for Better Grades!

Ask an Expert

Our Experts can answer your tough homework and study questions
154049 Computer Science Questions Answered!
Post a Question