Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please respond in Python, thanks! Q1. (25 points) You buy an international calling card to India. The calling card company has some special offers. (a)
Please respond in Python, thanks!
Q1. (25 points) You buy an international calling card to India. The calling card company has some special offers. (a) If you charge your card with $5 or $10, you don't get anything extra. (b) For a $25 charge, you get $3 of extra phone time. (c) For a $50 charge, you get $8 of extra phone time. (d) For a $100 charge, you get $20 of extra phone time. Write a function that asks the user for the amount he/she wants on the card and returns the total charge that the user gets. Print the total charge available to the user by calling the function. Note: Values other than those mentioned above are not allowed. Sample Output: Enter amount a 5, 10, 25, 50, or 100: 5 You have $5 available on your card. Enter amount a 5, 10, 25,50 , or 100:10 You have $10 available on your card. Enter amount a 5,10,25,50, or 100:55 Improper amount entered. Try again. Enter amount a 5,10,25,50, or 100:50 You have $58 available on your card. Enter amount a 5,10,25,50, or 100:100 You have $120 available on your card. Enter amount a 5,10,25,50, or 100:1 Improper amount entered. Try again. Enter amount a 5,10,25,50 or 100:15 Improper amount entered. Try again. Enter amount a 5,10,25,50 or 100:150 Improper amount entered. Try again. Enter amount a 5,10,25,50 or 100:30 Improper amount entered. Try again. Enter amount a 5,10,25,50 or 100:25 You have $28 available on your card. Q2. (25 points) Suppose you are purchasing something online on the Internet. At the website, you get a 10% discount if you are a member. Additionally, you are also getting a discount of 5% on the item because its President's Day. Write a function that takes as input arguments the cost of the item that you are purchasing and a Boolean variable indicating whether you are a member (or not), applies the discounts appropriately, and returns the final discounted value of the item. (Note: The cost of the item need not be an integer.) In the program, get the cost of the item from the user in decimal (i.e., float) and the membership as a T or F response. Based on the membership response, set the membership Boolean variable to True or False. Then invoke (i.e., call) the function to get the final cost and then display it back to the user. Sample Output: Enter the cost of the item you are purchasing as decimal (e.g., 12.75): 50.50 Are you a member? (Enter T or F only): F Your final cost of the product is: $47.98 Enter the cost of the item you are purchasing as decimal (e.g., 12.75): 50.50 Are you a member? (Enter T or F only): T Your final cost of the product is: $42.92Step 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