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 Python Code for Review
#the main function
def main():
endProgram = 'no'
while endProgram == 'no':
# 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):
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 ' SAVINGS '
print '_____________________________________________________'
print 'SAVINGS NOT GREEN GONE GREEN MONTH'
print '_____________________________________________________'
while counter < 12:
print '$', savings[counter], ' $', notGreenCost[counter], ' $', goneGreenCost[counter], ' ', months[counter]
counter = counter + 1
# calls main
main(
Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a...
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...
(InputMismatchException) and (ArrayIndexOutOfBoundsException): Using the two arrays shown below, write a program that prompts the user to enter an integer between 1 and 12 and then displays the months and its number of days corresponding to the integer entered. 1. Your program should display “Wrong number - Out of Bounds” if the user enters a wrong number by catching ArrayIndexOutOfBoundsException. 2. Also the program should display “Mismatch – not a number” if the user enters anything other than an integer...
:) Problem: ??? Your task: implement in CH the algorithm solution shown below. Then analyze it and explain, using just one or two sentences, what it does. Write this explanation as a comment at the top of your program. This explanation will be worth 5 points of your total grade. Do not be too detailed (for example, do not write it opens a file and then declares variables, and then reads from a file...), it should look like the problem...
Coding in C++ Write a program using structures to store the following weather information: - Month name - Day of month (Monday, Tuesday, etc) - High Temperature - Low Temperature - Rainfall for the day Use an the input.txt file to load the data into weather structures. Once the data for all the days is entered, the program should calculate and display the: - Total rainfall for the data - Average daily temperatures. (note: you'll need to calculate the days...
Assuming that a year has 365 days, write a class named DayOfYear that takes an integer representing a day of the year and translates it to a string consisting of the month followed by day of the month. For example, Day 2 would be January 2. Day 32 would be February 1. Day 365 would be December 31. The constructor for the class should take as parameter an integer representing the day of the year, and the class should have...
Write a C# program that prints a calendar for a given year. Call this program calendar. This program needs to use Switch Case in order to call the methods and format to print each month. The program prompts the user for two inputs: 1) The year for which you are generating the calendar. 2) The day of the week that January first is on, you will use the following notation to set the day of the week: ...
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...
Write a C# program that prints a calendar for a given year. Call this program calendar. The program prompts the user for two inputs: 1) The year for which you are generating the calendar. 2) The day of the week that January first is on, you will use the following notation to set the day of the week: 0 Sunday 1 Monday 2 Tuesday 3 Wednesday 4 Thursday 5 Friday 6 Saturday Your program should...
Zybooks 11.12 LAB*: Program: Online shopping cart (continued) Python 3 is the code needed and this is in Zybooks Existing Code # Type code for classes here class ItemToPurchase: def __init__(self, item_name="none", item_price=0, item_quantity=0): self.item_name = item_name self.item_price = item_price self.item_quantity = item_quantity # def __mul__(self): # print_item_cost = (self.item_quantity * self.item_price) # return '{} {} @ ${} = ${}' .format(self_item_name, self.item_quantity, self.item_price, print_item_cost) def print_item_cost(self): self.print_cost = (self.item_quantity * self.item_price) print(('{} {} @ ${} = ${}') .format(self.item_name, self.item_quantity, self.item_price,...
Fast Deliveries, Inc. (FDI), was organized in December last year and had limited activity last year. The resulting bala sheet at the beginning of the current year is provided below: FAST DELIVERIES, INC. Balance sheet at January 1 Assets: Liabilities: Cash $19,900 Accounts Payable $ 500 Accounts Receivable 740 Stockholders' Equity: Supplies 770 Common Stock 11,410 Retained Earnings 500 Total Assets $12,410 Total liabilities and Stockholders' Equity $12,410 Two employees have been hired, at a monthly salary of $2,900 each....