I wrote this algorithm that is given your electric meter readings (in kilowatt-??hours) at the beginning and end of each month of the year. The algorithm determines your annual cost of electricity on the basis of a charge of 6 cents per kilowatt-??hour for the?rst 1,000 kilowatt-??hours of each month and 8 cents per kilowatt-??hour beyond 1,000. After printing out your total annual charge, the algorithm also determines whether you used less than 500 kilowatt-??hours for the entire year and, if so, prints out a message thanking you for conserving electricity.;Step 1: Set the value of i to1;Step 2: Set to the value of AnnualCharge to 0;Step 3: While i is greater than or equal to 12 do;Step 4: Get the value of KWBegini and KWEndi;Step 5: Set the value of MonthlyUsagei to KWEndi ? KWBegini;Step 6: If MonthlyUsagei < 1000 then;Step 7: Set AnnualCharge to AnnualCharge +(.06MonthlyUsagei);Step 8: Else;Step 9: Set AnnualCharge to AnnualCharge + (.06)1000 + (.08)(MonthlyUsagei ? 1000);Step 10: Set the value of i to i +1;End of While loop;Step 11: Print the value of AnnualCharge;Step 12: If (KWEnd 12 ? KWBegin1) < 500, then;Step 13: Print the message ?Thank you for conserving electricity.?;Ask the user for the next KWBegini and KWEndi each time through your loop and store them in two lists: one for all the KWBegin values and one for all the KWEnd values. You don?t need to keep track of the MonthlyUsage for each month.
Paper#64305 | Written in 18-Jul-2015Price : $27