The purpose of this challenge to use overloaded functions with : 864512
The purpose of this challenge is to use overloaded functions with default parameters. This functions simulates an insurance application calculator for life and auto.
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.