Functions with One or More Value Parameters | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Functions with One or More Value Parameters

RoundWeel provides car insurance. You are required to write a program to assist the company in calculating the monthly premiums for its customers. The customers should pay a standard fee of $850.00 per month. In addition to the standard fee, the following fees are applicable: -Experience: Experienced drivers pay less than less experienced drivers as follows: 0-2 years pay $150.00 extra 3-5 years pay $80.00 extra 6 and more years pay only $30 extra. -Age: Younger people pay more than older citizens as follows: 18-28: pays $50.00 extra 29-45: pays $30.00 extra 46-60: pays $20.00 extra 61 and above pays $30.00 extra. -Gender: Male customers pay an additional $10. -Marital status: People who are single or divorced (available) pay more than those who are married or living with their partners (not available). Available pays $40.00 extra. Write the following functions: -driversGroup: This function takes as its parameter driving experience and it returns the additional fee that the customer will have to pay. -ageGroup: This function takes as its parameter the age of the driver and it returns the additional fee that the customer will have to pay. The age should not be less than 18 years. -isMale: This function takes as its parameter the gender of the driver and it returns a true value if it is a male. The function should only accept 'M' or 'm' for male and 'F' or 'f' for female. -isAvailable: This function takes as its parameter the marital status of the driver and it returns a true value if the customer is single or divorced. The function should only accept 'S' or 's' for single, 'D' or 'd' for divorced, 'M' or 'm' for married, and 'L' or 'l' for living with a partner. -computePremium: The function takes as its parameters the experience, age, gender and marital status and return the total premium to be paid. This function should use the functions that you wrote above. -Add a main() function to demonstrate the use of these functions.

18th Sep 2017, 11:11 PM
gorgamin
gorgamin - avatar
1 Answer
0
Take a look at this: https://code.sololearn.com/c0eoJCtO1qi8/#cpp Let me know if you have any questions at terrestrial.primate@gmail.com .
6th Jul 2018, 10:04 PM
Louie
Louie  - avatar