Calculate an energy bill from meter readings to display on a smart meter.
With the invention of the dynamo in 1861, electrical energy could be generated in large amounts. The first mass application of electricity was lighting. When this new product – electrical energy – started to be sold, it was obvious that the cost had to be determined. The earliest meter was Samual Gardiner’s (USA) lamphour meter patented in 1872. It measured the time during which energy was supplied to the load, as all the lamps connected to this meter were controlled by one switch. Subdividing lighting circuits became practical with the introduction of Edison’s light bulb, and this meter became obsolete.
⭐⭐⭐
Write a program that calculates the cost of energy from a previous and current meter reading. The kilowatt hours is the total units_used between the two readings multiplied by 1.022 multiplied by the calorific_value divided by 3.6. The cost in pounds sterling is 0.0284 multiplied by kilowatt hours.
Remember to add a comment before a subprogram to explain its purpose.
energy_cost that:previous_meter_reading, current_meter_reading and calorific_value.main program so that:Enter the previous meter reading: 2022
Enter the current meter reading rounded down: 2305
Cost is £ 89
Enter the previous meter reading: 7666
Enter the current meter reading rounded down: 8241
Cost is £ 182