Questions
Define a JavaScript function named prepend that has two parameters. The first parameter is an array...

Define a JavaScript function named prepend that has two parameters. The first parameter is an array of Strings. The second parameter is a String. Your function should use the accumulator pattern to return a newly created array whose elements are the concatenation of the second parameter with the element at the same index in the first parameter.

In: Computer Science

I have created a MinHeap program without using arrays. Below is the followup question : The...

I have created a MinHeap program without using arrays. Below is the followup question :

The heap class is a collection. Determine the correct location in your language’s collection
class hierarchy. Find all methods that you need to implement in order to add your class in
the language’s collection class hierarchy.

What does this mean and how to implement it?

In: Computer Science

(Business: check ISBN-13) ISBN-13 is a new standard for indentifying books. It uses 13 digits d1d2d3d4d5d6d7d8d910d11d12d13...

(Business: check ISBN-13)

ISBN-13 is a new standard for indentifying books. It uses 13 digits d1d2d3d4d5d6d7d8d910d11d12d13 . The last digit d13 is a checksum, which is calculated from the other digits using the following formula:

10 - (d1 + 3*d2 + d3 + 3*d4 + d5 + 3*d6 + d7 + 3*d8 + d9 + 3*d10 + d11 + 3*d12) % 10

If the checksum is 10, replace it with 0. Your program should read the input as a string. Display “incorrect input” if the input is incorrect.

Sample Run 1

Enter the first 12 digits of an ISBN-13 as a string: 978013213080

The ISBN-13 number is 9780132130806

Sample Run 2

Enter the first 12 digits of an ISBN-13 as a string: 978013213079

The ISBN-13 number is 9780132130790.

In Python.

In: Computer Science

In Python Which statement has a syntax error? Assume variables x, y, z, and age have...

In Python

Which statement has a syntax error? Assume variables x, y, z, and age have already been defined.

a.

y = y

b.

x + y = z

c.

age = '32'

d.

print('Name, age')

e.

None of the above

Which statement does not print a newline character at the end?

a.

print('First part…')

b.

print('First part…\n')

c.

print('First part…', end='')

d.

print('First part…', end=”-\n”)

e.

None of the above

Which function converts a string to an integer?

a.

int()

b.

integer()

c.

string_to_int()

d.

convert(string, int)

e.

None of the above

In: Computer Science

Evaluate the impact of contemporary information systems and the Internet on the protection property. Please discuss...

Evaluate the impact of contemporary information systems and the Internet on the protection property. Please discuss about the Copyright topic in specific.

In: Computer Science

// Java // This method takes an integer array as well as an integer (the starting...

// Java

// This method takes an integer array as well as an integer (the starting
// index) and returns the sum of the squares of the elements in the array.

// This method uses recursion.
public int sumSquaresRec(int[] A, int pos)
{
// TODO: implement this method
      
return -1; // replace this statement with your own return
}   

// This method takes a character stack and converts all lower case letters
// to upper case ones.
public void upperStackRec(CharStack s)
{
// TODO: implement this method
}
  
// This method reads a string and returns the string in the reversed order.
public String reverseStringRec(String s)
{
// TODO: implement this method
      
return "dummy string"; // replace this statement with your own return
}
  
// This method takes as parameters a reference to the head of a linked list, a
// position specified by n, and a key. It returns the number of occurrences
// of the key in the linked list beginning at the n-th node. If n = 0, it means
// you should search in the entire linked list. If n = 1, then you should skip
// the first node in the list.
public int numOccurrencesRec(LNode node, int n, int key)
{
// TODO: implement this method
      
return -1; // replace this statement with your own return   
}
}

In: Computer Science

Print out the following output. You must use exactly 2 for statements, 2 range statements, and...

Print out the following output. You must use exactly 2 for statements, 2 range statements, and 3 print statements. (python)

Calculating x **

1

1

3

5

====

Calculating x ** 2

1

9

25

====

Calculating x ** 3

1

27

125

====

In: Computer Science

Implement the Cstring function strcpy(dest, source) in c++. Do not use the library. The copy process...

Implement the Cstring function strcpy(dest, source) in c++. Do not use the library. The copy process will only stop at the last "\0". Make sure dest is large enough

In: Computer Science

Can anyone add a validation function to my html? First, ensure that your form uses at...

Can anyone add a validation function to my html? First, ensure that your form uses at least three of the following field types: check boxes, text boxes, option buttons, selection lists, and text areas. Then, program validation for your form ensuring that users enter values or make selections in all fields, and verifying at least one other aspect of at least one of the fields. Provide appropriate feedback to users when the form fails validation. Test your completed program until all validation works reliably with different combinations of valid and erroneous data.

<------------------------------------------------------------------------------------------------------->

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Case Project</title>
<link href="layout.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Lamborghini</h1>
<p><a href='index.html'>Lamborghini</a> <a href='ferrari.html'>Ferrari</a> <a href='bugatti.html'>Bugatti</a> <a href='rollsroyce.html'>Rolls-Royce</a></p>
<hr>
<p><img src='https://vignette.wikia.nocookie.net/pawnstarsthegame/images/6/6e/2003_Lamborghini_Murcielago.png'>The Aventador has been created to anticipate the future, as demonstrated by the use of innovative technology, including a V12 engine and the extensive use of carbon fiber. The authentic design masterpieces together stark dynamism with aggression to produce a cutting edge carbon fiber monocoque. The interior of the Aventador combines high-level technology and luxury equipment with premium-quality materials, skilfully crafted with the expertise characteristic of the finest Italian traditions. A supercar family that has already become a legend in its own right. Discover technical specifications, dimensions, performance, and the detailed features of all the new Lamborghini Aventador models.</p>
  

</script>
</body>
</html>

In: Computer Science

Sorting (selection, bubble, insertion) Suppose an array contains the following integers: -1, 20, 10, -5, 0,...

Sorting (selection, bubble, insertion)

Suppose an array contains the following integers: -1, 20, 10, -5, 0, -7, 100, -7, 30, -10. Sort the array using the following algorithms: selection sort, bubble sort, and insertion sort. For each algorithm, write the array content after each pass (i.e., from pass 1 to pass 9). Each pass is defined as one iteration of the outer loop. There are total of n − 1 passes, where n is the array size.


The answer should not be Java or code

In: Computer Science

PYTHON PROGRAM! Exercise 3 - Go forth and discover! Find some interesting good sized text datasets...

PYTHON PROGRAM!

Exercise 3 - Go forth and discover!

Find some interesting good sized text datasets (most likely csv's) of at least several hundred points online. These could be related to any topic. Some ideas might be:

  • COVID-19 statistics or science
  • Wildlife populations
  • Cost vs. strength of building materials
  • Solar Power generation
  • etc . . .

Use Python to import one of those datasets and provide at least 2 useful visualizations (charts) of that data on a single figure. You may use any chart type that would be useful, and you can certainly pre-process or analyze the data (i.e. see filtering to fires > 500 acres in Ex. 2) before plotting it. Make sure to label the charts appropriately.

In: Computer Science

Write assembly code for the following C procedure: i = 1; sum = 0; while (i...

Write assembly code for the following C procedure:

i = 1; sum = 0;

while (i ≤ n) {

sum += i;

++i;

}

i and sum corresponds to $s1 and $s2. n is preloaded into $s3

In: Computer Science

write three functions in C++: one that declares a large array statically, one that declares the...

write three functions in C++: one that declares a large array statically, one that declares the same array on the stack, and one that creates the same array on the heap. Call each of them a number of times (at least 100,000) and output the time required by each. Explain the results.

In: Computer Science

Q. 3 [35 pts] Print out the following output. You must use exactly 2 for statements,...

Q. 3 [35 pts] Print out the following output.

You must use exactly 2 for statements, 2 range statements, and 3 print statements. No modules are to be used for this problem.

Calculating x ** 1
1
3
5
====
Calculating x ** 2
1
9
25
====
Calculating x ** 3
1
27
125
====

In: Computer Science

Java - In this lab, you will be writing your own method using the brute force...

Java - In this lab, you will be writing your own method using the brute force algorithm, to solve a second degree polynomial.
This method will take in four parameters, three coefficients, and one constant, and it will have the following signature:

public static String bruteForceEquationSolver(int one, int two, int three, int constant){}

The equation you are trying to solve is of the following format, given the parameters stated above:

(constant) = (one) * x + (two) * y + (three) * z

X, Y, and Z are variables that you are finding solutions for.

For example, if you were to call the method with parameters (2, 3, 4, 42), you would be finding the solution for the equation 2x + 3y + 4z = 42.

Some specifications for the method:

  • Your method should try every possibility within the range (1-10) for each variable. Check possibilities using nested for loops, starting with x, then y, then z.
  • Your method should return if a solution is found, and return a string with the solutions in the following format:

    x: xSolution y: ySolution z: zSolution

    There should be a space between the solution and the next variable, and each variable letter should be followed by a colon and a space.

  • If no solution is found, return the string “Solution not found.”.

Call the testBFES() method from main after completing this method to ensure it is working as expected.

Here's what I have so far:

public static String bruteForceEquationSolver(int one, int two, int three, int constant) {
    // student code here
        for (int i = 1; i <= 10; i++) {
            for (int j = 1; j <= 10; j++) {
                for (int k = 1; k <= 10; k++) {
                }
            }
        }
        return String.format("x:%d y:%d z:%d", one, two, three); 
}
public static void testBFES() {
System.out.println("Testing Brute Force Equation Solver");
String expected = "x: 2 y: 3 z: 4";
System.out.println("Expecting: " + expected);

String actual = bruteForceEquationSolver(3, 4, 6, 42);
System.out.println("Actual: " + actual);

boolean correct = expected.equals(actual);
System.out.println("Outputs equal? " + correct);
}

public static void testMT() {
System.out.println("Testing Multiplication Table");

String expected = "1\t2\t3\t4\t\n2\t4\t6\t8\t\n3\t6\t9\t12\t\n";
System.out.print("Expecting:\n" + expected);

String actual = multiplicationTable(3, 4);
System.out.print("Actual:\n" + actual);

boolean correct = expected.equals(actual);
System.out.println("Outputs equal? " + correct);
}

In: Computer Science