Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the Python code for the following programming problem below.You must use m

ID: 3635538 • Letter: W

Question

Write the Python code for the following programming problem below.You must use modular design.

Last year, a local college implemented rooftop gardens as a way to promote energy efficiency and save money. Write a program that will allow the user to enter the energy bills from January to December for the year prior to going green. Next, allow the user to enter the energy bills from January to December of the past year after going green. The program should calculate the energy difference from the two years and display the two years worth of data, along with the savings.

Hints: Create three arrays of size 12 each. The first array will store the first year of energy costs, the second array will store the second year after going green, and the third array will store the difference. Also, create a string array that stores the month names. These variables might be defined as follows:

notGreenCost = [0] * 12

goneGreenCost = [0] * 12

savings = [0] * 12

months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

Your sample input must look as follows.  Notice the messages and the prompts.

 

*****This program calculates the energy savings for AK’s College  Turned Green*****

 

Enter NOT GREEN energy costs for January

Enter now -->789

Enter NOT GREEN energy costs for February

Enter now -->790

Enter NOT GREEN energy costs for March

Enter now -->890

Enter NOT GREEN energy costs for April

Enter now -->773

Enter NOT GREEN energy costs for May

Enter now -->723

Enter NOT GREEN energy costs for June

Enter now -->759

Enter NOT GREEN energy costs for July

Enter now -->690

Enter NOT GREEN energy costs for August

Enter now -->681

Enter NOT GREEN energy costs for September

Enter now -->782

Enter NOT GREEN energy costs for October

Enter now -->791

Enter NOT GREEN energy costs for November

Enter now -->898

Enter NOT GREEN energy costs for December

Enter now -->923

-----------------------------------------------------

 

Enter GONE GREEN energy costs for January

Enter now -->546

Enter GONE GREEN energy costs for February

Enter now -->536

Enter GONE GREEN energy costs for March

Enter now -->519

Enter GONE GREEN energy costs for April

Enter now -->493

Enter GONE GREEN energy costs for May

Enter now -->472

Enter GONE GREEN energy costs for June

Enter now -->432

Enter GONE GREEN energy costs for July

Enter now -->347

Enter GONE GREEN energy costs for August

Enter now -->318

Enter GONE GREEN energy costs for September

Enter now -->453

Enter GONE GREEN energy costs for October

Enter now -->489

Enter GONE GREEN energy costs for November

Enter now -->439

Enter GONE GREEN energy costs for December

Enter now -->516

 

Do you want to end program? (Enter no or yes): yes

 

 

Your sample output must look as follows:

 

                        SAVINGS                     

_____________________________________________________

SAVINGS     NOT GREEN     GONE GREEN         MONTH

_____________________________________________________

 

$ 243.00     $ 789.00      $ 546.00          January

 

$ 254.00     $ 790.00      $ 536.00          February

 

$ 371.00     $ 890.00      $ 519.00          March

 

$ 280.00     $ 773.00      $ 493.00          April

 

$ 251.00     $ 723.00      $ 472.00          May

 

$ 327.00     $ 759.00      $ 432.00          June

 

$ 343.00     $ 690.00      $ 347.00          July

 

$ 363.00     $ 681.00      $ 318.00          August

 

$ 329.00     $ 782.00      $ 453.00          September

 

$ 302.00     $ 791.00      $ 489.00          October

 

$ 459.00     $ 898.00      $ 439.00          November

 

$ 407.00     $ 923.00      $ 516.00          December

 

I have the full program written but seem to be having errors, so im looking for a full working program that I can compare mine with so I can see where i went wrong. Thank you

Explanation / Answer

//main module

def Main()

notGreenCost = zeros(12,Float)

goneGreenCost = zeros(12,Float)

savings = zeros(12,Float)

months=str.array(itemsize=8,shape=12)

months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

for index in range(12):

print"Enter NOT GREEN energy costs for ",months[index]

notGreenCost[index]=Input("Enter now->")

for index in range(12):

print"Enter GONE GREEN energy costs for ",months[index]

goneGreenCost[index]=Input("Enter now->")

print"---------------------------------------"

print"SAVINGS NOT GREEN GONE GREEN MONTH"

print"---------------------------------------"

for index in range(12):

   savings[index]= notGreenCost [index]- goneGreenCost[index]

    print"$",savings[index]

     print"$", notGreenCost [index]

     print"$",goneGreenCost[index]

     print months[index]

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote