Write a function called calcDiscount() to calculate and return the discount amount when thefollowing are passed as the parameters.• If the inpatient is a senior citizen, value Y will be passed to the function and otherwise,value N will be passed.• If the inpatient is a loyalty member of the hospital, value Y will be passed to the functionand otherwise, value N will be passed
Question
Write a function called calcDiscount() to calculate and return the discount amount when thefollowing are passed as the parameters.• If the inpatient is a senior citizen, value Y will be passed to the function and otherwise,value N will be passed.• If the inpatient is a loyalty member of the hospital, value Y will be passed to the functionand otherwise, value N will be passed
Solution
Here is a Python function that calculates the discount based on the parameters provided:
def calcDiscount(senior_citizen, loyalty_member):
discount = 0
if senior_citizen == 'Y':
discount += 0.10 # Assuming 10% discount for senior citizens
if loyalty_member == 'Y':
discount += 0.05 # Assuming 5% additional discount for loyalty members
return discount
In this function, we first initialize the discount to 0. Then, we check if the patient is a senior citizen. If they are, we add 10% (or 0.
Similar Questions
Suwasetha Hospital provides different types of accommodation facilities for their inpatients.The details are given below.Accommodation Type Description The Charge Per Day (Rs.)1 Deluxe Room 17000/=2 Grand Deluxe 25000/=3 Grand Suite 32000/=a) Write a function called calcPayment() to calculate and return the payment of an inpatientwhen the medical charge, the accommodation type, and no. of days stayed are passed as theparameters of the function.Payment = Medical charge + Accommodation facility chargeFunction prototype is given below.float calcPayment(float medicalCharge, int type, int days)b) The hospital has decided to offer several discounts for their inpatients.• If the inpatient is a senior citizen, a discount of 5% will be given.• If the inpatient is a loyalty member of the hospital, a discount of 10% will be given.Write a function called calcDiscount() to calculate and return the discount amount when thefollowing are passed as the parameters.• If the inpatient is a senior citizen, value Y will be passed to the function and otherwise,value N will be passed.• If the inpatient is a loyalty member of the hospital, value Y will be passed to the functionand otherwise, value N will be passed.Discount = Payment * Total discount / 100The function prototype is given below.float calcDiscount(char seniorCitizen, char loyaltyMember)c) Write a function called testCalcPayment() which contains two assert statements to debugthe implemented calcPayment() function.d) In your main function do the following,i. Call testCalcPayment() function.ii. Allow the user to enter the medical charge, the accommodation type, and no. ofdays stayed from the keyboard. Call function calcPayment()
Discount Calculator:Build a program that calculates the discounted price of an item based on the original price and a discount percentage. If the original price is greater than 1000, apply a 10% discount; otherwise, apply a 5% discount.
Generate boarding pass for the passengers of a ship which starts from Chennai to Andaman. The boarding pass must be generated automatically with a pass number that begins with "CA" and followed by a number that is automatically incremented from value 'x', details like passenger name, age, mobile number, address, date of journey and fare. There is a seasonal discount based on the age of the passengers. Write a non member function called discount which calculates the discount in the fare for the passenger with the following discounts. For the age group `between 12 and 58, both inclusive’ there is 20% discount in the fare, for the age group ‘above 58’, there is 40% discount and for the children (age under 12), 50% discount. Write a C++ program to generate pass for 'n' users. Input Format:Passenger nameValue of 'x'AgeAddressdate_of_Journeymobile numberOriginal FareOutput Format:passenger nameBoarding pass numberagedate_of_Journeymobile numberTotal fare after discount based on ageBoundary Conditions:>=1
enter a formula to determine any discount that should be applied. If the payment method in column F was Rewards, the customer should receive the discount shown in B42, otherwise the formula should return a zero. Use the named range for cell B42, not the cell address, in this formula.
Customer Lifetime ValueWhat does DR represent in the formula for calculating the customer lifetime value?Discount offered to the customers on a yearly basisThe rate at which future revenues are discounted to calculate the present value of future revenueThe rate of taxes that are to be paid every yearNone of the above
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.