Question

The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for...

The electric company charges according to the following rate schedule:

9 cents per kilowatt-hour (kwh) for the first 300 kwh
8 cents per kwh for the next 300 kwh (up to 600 kwh)
6 cents per kwh for the next 400 kwh (up to 1000 kwh)
5 cents per kwh for all electricity used over 1000 kwh

Write a program that would repeatedly read in a customer number (an integer) and the usage for that customer in kwh (an integer). The program should include a method to compute the total charge for each customer. Use the following template for the method:

// takes kwh and calculates the total charge for that customer.

public static double findCharge(int kwh){

        // put your code here

}

The program should terminate when the user enters a sentinel value of -999 for the customer number. The program should print a three-column chart listing the customer number, the kilowatt-hours used, and the total charge for each customer. The program should also compute and print the number of customers, the total kilowatt-hours used, and the total charges. Use a JTextArea component within a JOptionPane dialog box to display the output. Should not use arrays for this program.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

clouble total ) rt oid) Setchav C) total + -3000.0c, total: 360 *0.09clse ebr totol t kah ¥ 0.06 cha3ed Ž.uph. , tuj.., um, K hu. , final tot) saota

Add a comment
Know the answer?
Add Answer to:
The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • USE C++ Hyde Park Electric Co. bills its customers on the basis of kilowatt hours (KWH)...

    USE C++ Hyde Park Electric Co. bills its customers on the basis of kilowatt hours (KWH) used, as follows: Kilowatt hours (KWH) used​​​Rate 1-100 7 cent per KWH 101-250 RM7.00 + 5 cents * KWH over 100 251-750 RM14.50 + 4 cents * KWH over 250 Over 750​​​​​RM34.50 + 3 cents * KWH over 750 The input will include each customer’s name, Account number and the number of kilowatt hours used (must be a positive value). The output should display...

  • Energy consumption is measured in units of kilowatt hours (kWh). The more kWh a household use...

    Energy consumption is measured in units of kilowatt hours (kWh). The more kWh a household use in a month, the higher the energy bill. A power company charges customers $0.12 per kWh for the first 500 kWh. After the first 500 kWh, the rate is $0.15 per kWh. Write a program to calculate energy charge. You must write and use the following two functions. (a) A main function: Ask the user to enter number of kWh used. Call the bill_calculator...

  • Question 5 (a) A electric power distributor charges residential customers $0.10 per kilowatt-hour (kWh) The company...

    Question 5 (a) A electric power distributor charges residential customers $0.10 per kilowatt-hour (kWh) The company advertises that "green power" is available in 150 kWh blocks for an additional $4 per month per block. (i) A customer uses an average of 300k Wh per month and commits to one monthly 150k Wh (3 marks) (4 marks) (4 marks) block of green power, what is the annual power bill? (ii) What is the average cost per kWh using green power during...

  • 2. Suppose that an electric company charges consumers $.10 per kilowatt hour for electricity for the...

    2. Suppose that an electric company charges consumers $.10 per kilowatt hour for electricity for the first 1,000 kilowatt hours used in a month but $.15 for each extra kilowatt hour after that. Draw the budget constraint for a consumer facing this price schedule, and discuss why many individuals may choose to consume exactly 1,000 kilowatt hours.

  • A local electric company charges a base fee of $8 per month. They charge an additional...

    A local electric company charges a base fee of $8 per month. They charge an additional $0.1125 per kilowatt hour of electricity used. Use this information to answer the following. When you type in your answers, make sure to type the A, B, C, etc. so I know which answer goes to which part of the question. A. Write an equation to represent the total cost a customer will pay for their electric service. Let C represent the total monthly...

  • Write a program that will calculate and print bills for the city power company. The rates...

    Write a program that will calculate and print bills for the city power company. The rates are computed as follows: $60 flat fee for the first 1000 kwh and $0.05 for each additional kwh used. Your program should prompt the user to enter the consumption of kwh (in integer) and display the total amount of charge (use %.2f for the display). Sample Test 1: Enter kwh used: 945 Your total charge is $60.00 Sample Test 2: Enter kwh used: 1100...

  • JAVA *REFER TO THE PICTURES* Summary Write a program that will calculate the monthly electric charges...

    JAVA *REFER TO THE PICTURES* Summary Write a program that will calculate the monthly electric charges for a customer given a starting and ending readings from an electric meter. Charges will depend on the actual usage and the results will be displayed to the user Requirements From the user, get the month for the readings From the user, get the starting and ending reading values (in kWh) (integers) Standard rate is 42 cents per kWh Overage rate is 48 cents...

  • INSTRUCTION AND PROBLEMS Write a Python program for each of the problems in this lab. Please...

    INSTRUCTION AND PROBLEMS Write a Python program for each of the problems in this lab. Please use PyCharm to type and test your programs. Submit the Python files to Blackboard for credit. In this lab, you should submit 4 Python files, one for each problem PROBLEM I Energy consumption is measured in units of kilowatt hours (kWh). The more kWh a household use in a month, the higher the energy bll. A power company charges customers $0.12 per kWh for...

  • [10 marks) 5. An electricity company charges its customers a base rate of $15 a month...

    [10 marks) 5. An electricity company charges its customers a base rate of $15 a month plus 8 cents per kilowatt-hour (kWh) for the first 1200 kWh and 12 cents per kWh for usage over 1200 kWh. Write the cost, C, in dollars as a function of x, the number of kWh used for 05x< 1500 and graph the function [8 marks] 6. A certain paper book sells for $25. The author receives a royalty of 12% on the first...

  • The utility department of Brentwood City needs you to write a C++ program that will print...

    The utility department of Brentwood City needs you to write a C++ program that will print out a customer's bill. The program should input the following items from the file named "utility.txt" (which you may copy from the class data share or Blackboard): The customer number (6-digit integer) The number of gallons of water used (floating-point, no more than 999.99) The number of kilowatts of electricity used (integer, no more than 999) The number of cubic feet of natural gas...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT