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 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

In: Computer Science

What is the error message that occurs when the manager sends Set_Request to a read-only object?...

What is the error message that occurs when the manager sends Set_Request to a read-only object? Also, list out any three error messages in SNMP v1.

In: Computer Science

JAVA Specify, design, and implement a class called PayCalculator. The class should have at least the...

JAVA

Specify, design, and implement a class called PayCalculator. The class should have at least the following instance variables:

  • employee’s name

  • reportID: this should be unique. The first reportID must have a value of 1000 and for each new reportID you should increment by 10.

  • hourly wage

Include a suitable collection of constructors, mutator methods, accessor methods, and toString method. Also, add methods to perform the following tasks:

  1. Compute yearly salary - both the gross pay and net pay

  2. Increase the salary by a certain percentage

  3. Compute pay check net pay for a given pay period (there are 26 pay periods per year). Here is what you have to consider when computing the net pay:

    1. Federal Tax deductions – 9%

    2. State Tax deductions – 2%

    3. Overtime - number of hours worked over the 80hrs full time load. Here is how you can calculate the overtime pay rate

overTimePay = regularPayRate * 1.5

  1. Compute pay check net pay for all pay periods (all 26 pay periods)

In: Computer Science

In C program #include<stdio.h> Write a program that prompts the user to input the elapsed time...

In C program

#include<stdio.h>

Write a program that prompts the user to input the elapsed time for an event in seconds.

The program then outputs the elapsed time in hours, minutes, and seconds.

Example (Numbers with underscore indicate an input):

Enter the elapsed time in seconds: 9630

The elapsed time in seconds = 9630

The equivalent time in hours:minutes:seconds = 02:40:30

HINT: Pay attention to the printf format descriptors.

In: Computer Science

// Create a higher order function and invoke the callback function to test your work. You...

// Create a higher order function and invoke the callback function to test your work. You have been provided an example of a problem and a solution to see how this works with our items array. Study both the problem and the solution to figure out the rest of the problems.

const items = ["Pencil", "Notebook", "yo-yo", "Gum"];

/*

// GIVEN THIS PROBLEM:

function firstItem(arr, cb) {

// firstItem passes the first item of the given array to the callback function.

}

// SOLUTION:

function firstItem(arr, cb) {

return cb(arr[0]);

}

// NOTES ON THE SOLUTION:

// firstItem is a higher order function.

// It expects a callback (referred to as `cb`) as its second argument.

// To test our solution, we can use the given `items` array and a variety of callbacks.

// Note how callbacks can be declared separately, or inlined.

// TEST 1 (inlined callback):

const test1 = firstItem(items, item => `I love my ${item}!`);

console.log(test1); // "I love my Pencil!"

// TEST 2 (declaring callback before hand):

function logExorbitantPrice(article) {

return `this ${article} is worth a million dollars!`;

};

const test2 = firstItem(items, logExorbitantPrice);

console.log(test2); // "this Pencil is worth a million dollars!"

*/

function getLength(arr, cb) {

// getLength passes the length of the array into the callback.

}

arr = [1, 12, 3, 2, 1, 5, 3, 4, 20]; //Sample array is taken

function print(array) {

array.forEach(function(eachName, index) {

console.log(index + 1 + ". " + eachName);

});

}

function last(arr, cb) {

// last passes the last item of the array into the callback.

}

function sumNums(x, y, cb) {

// sumNums adds two numbers (x, y) and passes the result to the callback.

}

function multiplyNums(x, y, cb) {

// multiplyNums multiplies two numbers and passes the result to the callback.

}

function contains(item, list, cb) {

// contains checks if an item is present inside of the given array/list.

// Pass true to the callback if it is, otherwise pass false.

}

/* STRETCH PROBLEM */

function removeDuplicates(array, cb) {

// removeDuplicates removes all duplicate values from the given array.

// Pass the duplicate free array to the callback function.

// Do not mutate the original array.

}

In: Computer Science

Create a project called FaceViewer with the following data: FaceComponent class will have: Make a new...

Create a project called FaceViewer with the following data:

FaceComponent class will have:

Make a new class called FaceComponent that extends JComponent

Create a paintComponent method that has a parameter of Graphics type

Cast the Graphics variable to Graphics2D

Create a circle Face that contains the following:

Blue Circle right eye. Green Square left eye. Left & right eye should be same distance from sides of face. Ellipse red nose with the center of the nose being the center of the face. Black line Mouth equal distance from both sides of the face.

The Tester Class needs to:

Contain a main() method that:

Construct a JFrame object.

Set the size of the frame.

Set the default close operation to exit when clicked

Set the title of the frame to FaceViewer.

Construct a FaceComponent object.

Add the component to the JFrame.

Make sure frame is visible

In: Computer Science

What are the similarities and the differences between Linux files and pipes

What are the similarities and the differences between Linux files and pipes

In: Computer Science

You are an analytics developer, and you need to write the searching algorithm to find the...

You are an analytics developer, and you need to write the searching algorithm to find the element. Your program should perform the following: Implement the Binary Search function. Write a random number generator that creates 1,000 elements, and store them in the array. Write a random number generator that generates a single element called searched value. Pass the searched value and array into the Binary Search function. If the searched value is available in the array, then the output is “Element found,” or else the output is “Not found.” This question must be done in Code Blocks for C++

In: Computer Science

I have a programming project due tonight that I have already done once but my professor...

I have a programming project due tonight that I have already done once but my professor sent back because he said I did it wrong. He wants the following using linked lists but i only know how to do it with Arrays. Please try to explain your answer to me and not just give it to me.

For this assignment you must write a program that implements a stack of integers. The stack should be implemented using classes and must support the push, pop, and peek stack operations, the isEmpty method, and overload operator<<. Your stack implementation should also handle popping or peeking at data from an empty stack without generating a runtime error. Your program should test the correctness of your implementation in function main. You should provide test case to verify your stack works for the following cases:

1. Pushing an element of data onto a newly created stack

2. Pushing an element of data onto a non-empty stack

3. Pushing an element of data onto an empty stack (Note: a stack is empty when it is newly created and after the last element is popped off the stack)

4. Popping a value from a newly created stack

5. Popping a value from a non-empty stack

6. Popping a value from an empty stack

7. Performing a sequence of consecutive pushes and pops

8. Peeking at the top of a newly create stack with peek

9. Peeking at the top of a non-empty stack

10. Peeking at the top of an empty stack.

Files Expected:

1. Main.cpp – File containing function main

2. Stack.h - File containing the Stack and Node class structures and definitions.

In: Computer Science

Find a newspaper article from the past month that shows a conviction or the ongoing prosecution...

Find a newspaper article from the past month that shows a conviction or the ongoing prosecution of a cybercrime perpetrator. Write a summary of 500 words in APA format with references to the article.

In: Computer Science

Two numbers a and b are called pythagorean pair if both a and b are integers...

Two numbers a and b are called pythagorean pair if both a and b are integers and there exists an integer c such that a2 + b2 = c2. Write a function pythagorean_pair(a,b) that takes two integers a and b as input and returns True if a and b are pythagorean pair and False otherwise.

In: Computer Science

#C language array must store at least 50 inputs Game Scores Assignment Outcomes: Demonstrate the ability...

#C language

array must store at least 50 inputs

Game Scores Assignment

Outcomes:

  • Demonstrate the ability to create a menu driven program.
  • Demonstrate the ability to create and use a 2D array on the stack.
  • Demonstrate the use of functions.
  • Demonstrate good programming style.

Program Specifications:

Your program will read in "game scores" from the user. Each score consists of a score for YOUR team and a score for the OTHER team. You don't need names or dates for the games. Just the scores. You'll use a 2D array to store the scores. The following menu options all need to be implemented:

***********************************************

**                 MAIN   MENU                     **

***********************************************

A) Enter game result

B) Current Record (# of wins and # of losses and # of ties)

C) Display ALL results from all games WON

D) Display ALL results ordered by opponent score from low to high.

E) Quit

Create a menu similar to the example above. The user will enter a single game result at a time.  All menu options should be implemented within programmer-defined function. Functions should be used as much as possible.

Submission Requirements:

Requirements will be same as the first assignment which will be the same for all future assignments.

YOU MAY NOT

  • Use global variables, in this or any program ever.
  • Use goto statement(s), in this or any program ever.

In: Computer Science

Suppose you are converting 273332 (base 10) to base 2 using the subtraction method. What is...

Suppose you are converting 273332 (base 10) to base 2 using the subtraction method. What is the decimal number you have left for conversion after 3 steps?

In: Computer Science

You are asked to create to to-do list program to store and manage to-do items for...

You are asked to create to to-do list program to store and manage to-do items for user.

You need to define a class to-do item which holds the following attributes:

• Id => number, generated by the program when item is created

• Title => string • Description => string

• Type (e.g. shopping, housing, work, etc.) => Enum

• Priority => number between 1 to 5

• Status => (e.g. done, in progress, hold, etc.) => Enum

• Create date => date struct, to be set on creation

• Due date => date struct

• Last modified date => date struct, to be changed every time user makes a change

Write (3) three different constructors beside default constructor to initialize:

1. Title, Description, Type

2. Title, Type, Priority,

3. Title, Type, Priority, Due date Write set / get function of each of the attribute defined above.

You are required to define a to-do list class which holds a one dimension array of to-do objects with MAX_SIZE = 100 and the list of the following functions:

• Constructor: to initialize an empty to-do list

• Copy constructor: to initialize to-do list from another to-do list

• Add to-do item: ask the user to enter the attributes for to-do item and then insert the to-do item to the bottom of the list

• Edit to-do item: ask the user which attribute to edit and then make the change to the existing to-do item

• Delete to-do item: ask the user for the id of to-do item to be deleted

• Delete multiple to-do item by type: ask the user for the type

• Delete multiple to-do item by status: ask the user for the status

• Write list to text file o Each line in the text file represent one to-do item, all attributes are written as comma separated

. • Read list from text file

• Sort list by: o Priority o Due date o Create date o Type with inner sort by: Priority Due date

• Print list to the console with different options: o All items o Filtered by type given by the user o Filtered by priority given by the user o One item by id given by the user

• Merge another to-do list: to define a function to pass an object of to-do list, the new items will be added to the bottom of the list

• Clone to-do list to another to-do list In addition, you need to define the following global functions:

• Copy to-do list items to 2 dimensional array, each row represents item’s type.

• Copy to-do list items to 3 dimensional array,

o Second dimension represents item’s type.

o Third dimension repreents the priority

In: Computer Science

Python. 5) What will the code below do? (Assume that we have a dataset df with...

Python.

5) What will the code below do? (Assume that we have a dataset df with these two columns named Occupation' and 'Age')

df.groupby('Occupation')['Age'].mean()

a) It will return the average age per occupation

b) It will return an error

c) It will return the total age per occupation

d) None of the options

6) df.describe() will return basic descriptive statistics only for numerical variables

True/False ?

7) Pandas dataframes can be converted into numpy arrays

Truse/False ?

In: Computer Science