Question: Write a program calculate _ fee ( member _ age, loyalty _ status ) , that calculates and returns the appropriate membership cost ( as

Write a program calculate_fee(member_age, loyalty_status), that calculates and returns the appropriate membership cost (as an integer) based on the member age (member_age) and loyalty status (loyalty_status) of an individual. The initial cost and discount ratio are specified as follows:
For member age below 25: initial cost is $50.
For member ages 25 to 40: initial cost is $100.
For member ages 41 to 60: initial cost is $200.
For member ages 61 and above: initial cost is $300.
Loyalty Status:
"good": 20% discount (discount ratio =0.8)
"regular": No discount (discount ratio =1)
"lapsed": 50% surcharge (discount ratio =1.5)
The formula for calculating the membership cost is: membership cost = initial cost * discount ratio. Given the member age and loyalty status (please use the exact strings "good", "regular", "lapsed"), the program should return the membership cost as an integer.
It is assured that member_age >=1 and loyalty_status is one of "good","regular" or "lapsed".
Example:
member_age =27
loyalty_status = "good"
calculate_fee(member_age, loyalty_status)-->80
'''
Explanation:
Based on the member_age and loyalty status, the initial cost and discount ratio are 100 and 0.8 respectively.
Thus the membership cost is 100*0.8=80.
'''

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!