Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

ISBN: 0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

What advice would you provide to Jennifer?

Answered: 1 week ago

Question

What are the issues of concern for each of the affected parties?

Answered: 1 week ago