Question
Program #2 (100 points) US government website says the following interesting information: In 2017, the average annual electricity consumption for a U.S. residential utility customer
Program #2 (100 points)
US government website says the following interesting information: In 2017, the average annual electricity consumption for a U.S. residential utility customer was 10,399 kilowatthours (kWh), an average of 867 kWh per month. Louisiana had the highest annual electricity consumption at 14,242 kWh per residential customer, and Hawaii had the lowest at 6,074 kWh per residential customer.
Let us compute the electricity usage and the bill for last month by asking a few questions to a homeowner. Here are the input parameters and output format. Input: # of light bulbs
Average # of hours each bulb is ON in a day AC unit's power Typical # of hours AC unit is ON in a day # of FANs
Average # of hours each Fan is ON in a day Per-unit price of electricity
Formatted output: Total electricity usage: NNNN kWh Bulbs: XX.X% AC: YY.Y% FANs: ZZ.Z% Electricity bill for the month: $ NNNN.NN
Notes:
- Assume that each bulb consumes 60W and each fan consumes 40W. - Assume that the home has only one AC unit and all other appliances including cooking range use other energy sources, NOT electricity. AC unit power is specified in watts. - 1 kWh stands for 1000 Watt-hours and it is considered as 1 unit of Electricity and the per-unit price is specified in cents. - Assume that the last month had 30 days.
sample input and output
# of light bulbs: 10 Average # of hours each bulb is ON in a day: 2.4 AC unit's power: 900 Typical # of hours AC unit is ON in a day: 10.5 # of FANs: 4 Average # of hours each Fan is ON in a day: 8.5 Per-unit price of electricity: 9.5
Total electricity usage: 368 kWh Bulbs: 11.8% AC: 77.1% FANs: 11.1% Electricitybillforthemonth:$ 34.91
IN C CODE (not C++ or java)
thank you!
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