Question
10. An Internet service provider sets its base rate for data transfers in a given month according to market conditions. Customers are billed for data
10. An Internet service provider sets its base rate for data transfers in a given month according to market conditions. Customers are billed for data transferred in a given month as follows:
Transfers up to and including 100 Gigabytes (GB) are charged this base rate per Gigabyte only.
Transfers over 100 GB up to and including 1000 GB are charged the base, plus an additional 15% of the base, plus an additional $0.07 per GB for each GB over 100GB.
Transfers above 1000 GB are charged simply twice the base per Gigabyte.
In your lab3.py file use BASE_RATE as a global constant to store the base rate price. Use the Design recipe to write the function, bill_amount(), which takes an amount of data transferred (gigabytes) and computes the total charge.
Write three "helper" functions (bill_small, bill_medium, bill_large) which each likewise take an amount of data, then calculates the charge according to the above schemes. E.g., bill_medium will expect a number between 101 and 1000, and return the base+(15% of base)+$0.07X(GB over 100).
The bill_amount function should call the appropriate helper as required. Bills should be rounded to the nearest cent.
PYTHON LANGUAGE
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