4. Write a program to calculate the electricity bill (accept number of unit from user) according to the following criteria: \begin{tabular}{ll} First 100 units & No charges \\ Next 100 units & Rs 5 per unit \\ After 200 units & Rs 10 per unit \end{tabular} (Example if user input 350 units total bill amount 2000)
Added by Angela N.
Close
Step 1
First, we need to accept the number of units from the user. We can use the `input()` function to do this. Show more…
Show all steps
Your feedback will help us improve your experience
Harriet O'Brien and 101 other Calculus 2 / BC educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
(Financial application: calculate tips) Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and total. For example, if the user enters 10 for subtotal and $15 \%$ for gratuity rate, the program displays $\$ 1.5$ as gratuity and $\$ 11.5$ as total. Here is a sample run:
Electricity rates An electric company charges its customers $\$ 0.0577$ per kilowatt-hour (kWh) for the first 1000 kWh used, $\$ 0.0532$ for the next 4000 kWh, and $\$ 0.0511$ for any kWh over $5000 .$ Find a piecewise-defined function $C$ for a customer's bill of $x \mathrm{kWh}$
Functions and Graphs
Graphs of Functions
6) Write a program that prompts the user to input a number: The program should then output the number and a message saying whether the number is positive, negative, or zero. 7) Write a program that asks the user the number of hours an employee worked and his hourly wage, computes his weekly pay. Count any hours over 40 as overtime at time-and-a-half.
Florencia C.
Recommended Textbooks
Calculus: Early Transcendentals
Thomas Calculus
Watch the video solution with this free unlock.
EMAIL
PASSWORD