Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started