Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the JavaScript code for the following programming problem based on the pseudocode below The Pseudocode Module main() //Declare local variables Declare String endProgram =

Write the JavaScript code for the following programming problem based on the pseudocode below

The Pseudocode

Module main()

//Declare local variables

Declare String 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]

While endProgram == no

//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[])

Declare Integer counter

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[])

Declare Integer counter

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[])

Declare Integer counter

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

10:16 AM Sun Jan 29 Answered: 1 week ago

Answered: 1 week ago

Question

=+What is the nature of the unions in the particular country?

Answered: 1 week ago