Question

hello help me asap please kindly "Programming Challenge 1 -- Going Green," of Starting Out with...

hello help me asap please kindly

"Programming Challenge 1 -- Going Green," of Starting Out with Programming Logic and Design.

Note: You are only required to create the flowchart for this activity; however, notice how the pseudocode compares to the given Python code for this assignment.

Lab 9: Arrays

This lab accompanies Chapter 8 of Gaddis, T. (2016). Starting out with programming logic and design (4th ed.). Boston, MA: Addison-Wesley.

Lab 9.5 – Programming Challenge 1 -- Going Green

Write the Flowchart for the following programming problem based on the pseudocode below.

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 output might look as follows:

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

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

                        SAVINGS                     

_____________________________________________________

SAVINGS     NOT GREEN     GONE GREEN         MONTH

_____________________________________________________

$ 243          $ 789          $ 546           January

$ 254          $ 790          $ 536           February

$ 371          $ 890          $ 519           March

$ 280          $ 773          $ 493           April

$ 251          $ 723          $ 472           May

$ 327          $ 759          $ 432           June

$ 343          $ 690          $ 347           July

$ 363          $ 681          $ 318           August

$ 329          $ 782          $ 453           September

$ 302          $ 791          $ 489           October

$ 459          $ 898          $ 439           November

$ 407          $ 923          $ 516           December

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

The Pseudocode

Module main()

            //Declare local variables

            Declare endProgram = “no”

            While endProgram == “no”

                        Declare Real notGreenCost[12]

                        Declare Real goneGreenCost[12]

                        Declare Real savings[12]

Declare String months[12] = “January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”

                       

                        //function calls

                        getNotGreen(notGreenCost, months)

                        getGoneGreen(goneGreenCost, months)

                        energySaved(notGreenCost, goneGreenCosts, savings)

                        displayInfo(notGreenCost, goneGreenCosts, savings, months)

           

                        Display “Do you want to end the program? Yes or no”

                        Input endProgram

            End While

End Module

Module getNotGreen(Real notGreenCost[], String months[])

            Set counter = 0

            While counter < 12

                        Display “Enter NOT GREEN energy costs for”, months[counter]

                        Input notGreenCosts[counter]

                        Set counter = counter + 1

            End While       

End Module

Module getGoneGreen(Real goneGreenCost[], String months[])

            Set counter = 0

            While counter < 12

                        Display “Enter GONE GREEN energy costs for”, months[counter]

                        Input goneGreenCosts[counter]

                        Set counter = counter + 1

            End While       

End Module

Module energySaved(Real notGreenCost[], Real goneGreenCost[], Real savings[])

            Set counter = 0

            While counter < 12

                        Set savings[counter] = notGreenCost[counter] – goneGreenCost[counter]

                        Set counter = counter + 1

            End While

End Module

Module displayInfo(Real notGreenCost[], Real goneGreenCost[], Real savings[], String months[])

            Set counter = 0

            While counter < 12

                        Display “Information for”, months[counter]

                        Display “Savings $”, savings[counter]

                        Display “Not Green Costs $”, notGreenCost[counter]

                        Display “Gone Green Costs $”, goneGreenCost[counter]

            End While

End Module

The Flowchart

            PASTE FLOWCHART HERE

The Python Code for Review

#the main function
def main():
  endProgram = 'no'
  print
  while endProgram == 'no':
    print
    # declare variables
    notGreenCost = [0] * 12
    goneGreenCost = [0] * 12
    savings = [0] * 12
    months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
 
    # function calls
    getNotGreen(notGreenCost, months)
    getGoneGreen(goneGreenCost, months)
    energySaved(notGreenCost, goneGreenCost, savings)
    displayInfo(notGreenCost, goneGreenCost, savings, months)
    endProgram = raw_input('Do you want to end program? (Enter no or yes): ')
    while not (endProgram == 'yes' or endProgram == 'no'):
      print 'Please enter a yes or no'
      endProgram = raw_input('Do you want to end program? (Enter no or yes): ')
 
#The getNotGreen function
def getNotGreen(notGreenCost, months):
  counter = 0
  while counter < 12:
    print 'Enter NOT GREEN energy costs for', months[counter]
    notGreenCost[counter] = input('Enter now -->')
    counter = counter + 1
  print '-------------------------------------------------'
 
#The goneGreenCost function
def getGoneGreen(goneGreenCost, months):
  print
  counter = 0
  while counter < 12:
    print 'Enter GONE GREEN energy costs for', months[counter]
    goneGreenCost[counter] = input('Enter now -->')
    counter = counter + 1
  print '-------------------------------------------------'
 
#determines the savings function
def energySaved(notGreenCost, goneGreenCost, savings):
  counter = 0
  while counter < 12:
    savings[counter] = notGreenCost[counter] - goneGreenCost[counter]
    counter = counter + 1
 
#Displays information
def displayInfo(notGreenCost, goneGreenCost, savings, months):
  counter = 0
  print
  print '                        SAVINGS                      '
  print '_____________________________________________________'
  print 'SAVINGS     NOT GREEN     GONE GREEN       MONTH'
  print '_____________________________________________________'
 
  while counter < 12:
    print
    print '$', savings[counter], '         $', notGreenCost[counter], '         $', goneGreenCost[counter], '         ', months[counter] 
    counter = counter + 1
  print  
  
    
# calls main
main()
0 0
Add a comment Improve this question Transcribed image text
Answer #1

FLOWCHART:

initMonths (String Array months) months[01January months[1] February months[2]March months(3]April months[4] May mo

Add a comment
Know the answer?
Add Answer to:
hello help me asap please kindly "Programming Challenge 1 -- Going Green," of Starting Out with...
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
  • Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a...

    Write the Flowchart for the following programming problem based on the pseudocode below. 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...

  • convert pseducode to c++ Starting out with Programming Logic and Design (3) - Read-only Terates once...

    convert pseducode to c++ Starting out with Programming Logic and Design (3) - Read-only Terates once for each student. The nested inner loop, in lines 27 through 31, iterates once for each test score. Program 5-20 1 1 This program averages test scores. It asks the user for th 2 1/ number of students and the number of test scores per stude Declare Integer numStudents 4 Declare Integer numTest Scores 5 Declare Integer total 6 Declare Integer student 7 Declare...

  • Hello I need help with python programming here is my code # Trivia Challenge # Trivia...

    Hello I need help with python programming here is my code # Trivia Challenge # Trivia game that reads a plain text file import sys def open_file(file_name, mode): """Open a file.""" try: the_file = open(file_name, mode) except IOError as e: print("Unable to open the file", file_name, "Ending program.\n", e) input("\n\nPress the enter key to exit.") sys.exit() else: return the_file def next_line(the_file): """Return next line from the trivia file, formatted.""" line = the_file.readline() line = line.replace("/", "\n") return line def next_block(the_file):...

  • The following is a program from Starting out with C++ by Toni Gaddis. I am getting the following error messages pertain...

    The following is a program from Starting out with C++ by Toni Gaddis. I am getting the following error messages pertaining to the lines: cin>>month[i].lowTemp; and months[i].avgTemp = (months[i].highTemp + month[i].lowTemp)/2; The error messages read as follows: error C2039: 'lowTemp': is not a member of 'std::basic_string<_Elem,_Traits,_Ax>' and it continues. The second error message is identical. The program is as follows: Ch. 11, Assignment #3. pg. 646. Program #4. //Weather Statistics. //Write a program that uses a structure to store the...

  • Please help me solve this. XxE6-26A (book/static) Question Help Melody Leigh, owner of Broadway Floral, operates...

    Please help me solve this. XxE6-26A (book/static) Question Help Melody Leigh, owner of Broadway Floral, operates a local chain of floral shops. Each shop has its own delivery van. Instead of charging a flat delivery fee, Leigh wants to set the delivery fee based on the distance driven to deliver the flowers. Leigh wants to separate the fixed and variable portions of her van operating costs so that she has a better idea how delivery distance affects these costs. She...

  • Hello, my name is Shady Slim. I understand you are going to help me figure out...

    Hello, my name is Shady Slim. I understand you are going to help me figure out my gross income for the year... whatever that means. It's been a busy year and I'm a busy man, so let me give you the lowdown on my life and you can do your thing I was unemployed at the beginning of the year and got $2,000 in unemployment compensation. I later got a job as a manager for Roca Cola. I earned $57,500...

  • Hello! I'm posting this program that is partially completed if someone can help me out, I...

    Hello! I'm posting this program that is partially completed if someone can help me out, I will give you a good rating! Thanks, // You are given a partially completed program that creates a list of employees, like employees' record. // Each record has this information: employee's name, supervisors's name, department of the employee, room number. // The struct 'employeeRecord' holds information of one employee. Department is enum type. // An array of structs called 'list' is made to hold...

  • Can you please help me with creating this Java Code using the following pseudocode? Make Change C...

    Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.)                                                                                                                                  2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...

  • Please, I need help, I cannot figure out how to scan variables in to the function...

    Please, I need help, I cannot figure out how to scan variables in to the function prototypes! ******This is what the program should look like as it runs but I cannot figure out how to successfully build the code to do such.****** My code: #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <math.h> #include <conio.h> float computeSeriesResistance(float R1, float R2, float R3); float computeParallelResistance(float R1, float R2, float R3); float computeVoltage(int current, float resistance); void getInputR(float R1, float R2, float R3); void getInputCandR(int...

  • guys need help please im super lost anyone save me do programming exercise top_div_array.cpp: Winning Division...

    guys need help please im super lost anyone save me do programming exercise top_div_array.cpp: Winning Division app (top_div.cpp) revisited to use arrays This is the same program done last week but using and passing arrays instead of individual variables. Start with the following file / cODE BELOW: // Name: top_div_array.cpp // Description: // This app inputs sales for four regional division and displays the highest. // To accomplish this, use two arrays of equal length - one for sales and...

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