Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A drug loses decayrate percent of its potency every month. Also, a drug is considered expired if it loses more than 50% potency. Your goal
A drug loses decayrate percent of its potency every month. Also, a drug is considered expired if it loses more than 50% potency.
Your goal is boolean function IsExpired(months,decayrate) that returns True if the drug has expired and False if it has not.
Example 1:IsExpired(10,10) should return True.
Explanation:The drug loses 10% potency every month. After 1st month the potency is 90%, after 2nd month its 81%. In this way, after 7th month the potency is 47.83%.
Example 2:IsExpired(15,4) should return False.
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