in 4 to 10 narrative sentences, tell a story about your most interesting experience or experiences with technology. You can discuss anything you wish about AI or computers or smart phones, but it could also be about toasters, cars, or even painting or sculpture or a building project. What did you learn about the world through your use of the technology you describe? Was it pleasant, or unpleasant? How did it re-orient you towards reality after you had the experience or experiences?
In: Computer Science
Complete the isScrambled() function to return True if stringA can be reordered to make stringB. Otherwise, return False. Ignore spaces and capitalization. You must use a list for this assignment. isScrambled( 'Easy', 'Yase' ) returns True isScrambled( 'Easy', 'EasyEasy' ) returns False isScrambled( 'eye', 'eyes' ) returns False isScrambled( 'abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba' ) returns True isScrambled( 'Game Test', 'tamegest' ) returns True.
In: Computer Science
Below, the prompts for the rings’ distances are unclear in terms of which ring is being examined. Rewrite your ring-distance prompt code so that users know which ring the prompt is for. The first two ring-distance prompts should look like this:
Enter ring #1’s distance from the center in cm:
Enter ring #2’s distance from the center in cm
Write a pseudocode algorithm that analyzes a tree’s annual growth rings. Your algorithm should initially ask the user for the number of annual growth rings that are to be entered. Use a counter loop to ensure that the loop repeats that number of times. Inside the loop, your algorithm should ask the user to enter the distance in centimeters from the tree’s center for each ring, with the smaller ring values entered first. Also inside the loop, your algorithm should calculate the amount of growth that took place for the year associated with the current ring. Below the loop, print the growth for the year where the greatest growth took place.
In: Computer Science
JAVA programming - please ONLY answer prompts with java code *Inheritance* will be used in code
Classwork
A zoo is developing an educational safari game with various animals. You will write classes representing Elephants, Camels, and Moose.
Part A Think through common characteristics of animals, and write a class ZooAnimal.
☑ ZooAnimal should have at least two instance variables of different types (protected), representing characteristics that all animals have values for.
☑ It should also have at least two methods for behaviors that all animals do; these can simply print out a String stating what the animal is doing. (accessors and mutators are not behaviors). Include at least one parameterized constructor. Part B
☑ Create classes Elephant, Camel, and Moose, all of which extend ZooAnimal. In each, include a default constructor that calls the parameterized superclass constructor
. ☑ To one class (of Elephant, Camel, and Moose), add another instance variable specific to that type of animal. To another, add another behavior method. In a third, override a behavior from ZooAnimal. Part C
☑ Create a test harness for the animal classes. In a main create at least one Elephant, Camel, and Moose, and show which behavior methods are usable for each.
☑ [EC+10] Create another animal class inheriting from one of your three types (doesn't have to be zoologically accurate, but should make some sense), and either add an instance variable or add or override a method. This class should also be tested in the harness.
In: Computer Science
Design a nonrecursive post order traversal algorithm.
1.Use the linked representation for the binary tree to be traversed.
2.Except left, right, and data fields, there are no other fields in a node.
3.After the traversal the tree should remain intact.
4.Use only one stack.
5.You can’t push anything other than nodes into the stack.
In: Computer Science
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? 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 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:
Compute yearly salary - both the gross pay and net pay
Increase the salary by a certain percentage
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:
Federal Tax deductions – 9%
State Tax deductions – 2%
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
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 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 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 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
In: Computer Science
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 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 of a cybercrime perpetrator. Write a summary of 500 words in APA format with references to the article.
In: Computer Science