Question: Write a program calculate _ fee ( member _ age, loyalty _ status ) , that calculates and returns the appropriate membership cost ( as
Write a program calculatefeememberage, loyaltystatus that calculates and returns the appropriate membership cost as an integer based on the member age memberage and loyalty status loyaltystatus of an individual. The initial cost and discount ratio are specified as follows:
For member age below : initial cost is $
For member ages to : initial cost is $
For member ages to : initial cost is $
For member ages and above: initial cost is $
Loyalty Status:
"good": discount discount ratio
"regular": No discount discount ratio
"lapsed": surcharge discount ratio
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 memberage and loyaltystatus is one of "good","regular" or "lapsed".
Example:
memberage
loyaltystatus "good"
calculatefeememberage, loyaltystatus
Explanation:
Based on the memberage and loyalty status, the initial cost and discount ratio are and respectively.
Thus the membership cost is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
