void append(Node list1, Node list2)
If the list1 is {22, 33, 44, 55} and list2 is {66, 77, 88, 99} then append(list1, list2) will change list1 to {22, 33, 44, 55, 66, 77, 88, 99}. (5 Marks: 1mark for each correct step)
int sum(Node list)
If the list is {25, 45, 65, 85} then sum(list) will return 220. (5 Marks: 1mark for each correct step)
L.add(50);
L.add(60);
L.addFirst(10);
L.addLast(100);
L.set(1, 20);
L.remove(1);
L.remove(2);
L.removeFirst();
L.removeLast(); (10 Marks: 1 mark for each correct answer)
L.addFirst(10);
In: Computer Science
A standard science experiment is to drop a ball and see how high it bounces. Once the “bounciness” of the ball has been determined, the ratio gives a bounciness index.
For example, if a ball dropped from a height of 10 feet bounces 6 feet high, the index is 0.6, and the total distance traveled by the ball is 16 feet after one bounce. If the ball were to continue bouncing, the distance after two bounces would be 10 ft + 6 ft +6 ft + 3.6 ft = 25.6 ft. Note that the distance traveled for each successive bounce is the distance to the floor plus 0.6 of that distance as the ball comes back up.
Write a program that lets the user enter the initial height from which the ball is dropped, the bounciness index, and the number of times the ball is allowed to continue bouncing. Output should be the total distance traveled by the ball.
Below is an example of the program input and output:
Enter the height from which the ball is dropped: 25 Enter the bounciness index of the ball: .5 Enter the number of times the ball is allowed to continue bouncing: 3 Total distance traveled is: 65.625 units.
Please explain in Python language. Thanks in advance!
In: Computer Science
"How can I connect my hadoop database or mysql database server to my d3 visual?"
In: Computer Science
In: Computer Science
Sum all the elements in the two-dimensional array below. Print
the
// result to the console.
var arr = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
javascript
In: Computer Science
Please solve all. I don't have any more questions left. I will give thumbs up.
For Online Textbook Store & Payment System, please identify each of the requirements as a functional requirement/property or non-functional requirement/property. For every non-functional property/requirement, please add a remark to explain why.
10. The bookstore manager will be able to access the system in order to view sales summary reports.
11. Payments processed through the system are electronically transferred into the store’s bank account.
12. Bank sends monthly statements of account activity to the bookstore.
13. The system must be available for access 24/7.
14. Customers can select a preferred web browser to access the system.
15. A back up will be perform on the customer information and order information on a weekly basis.
16. Customers are not allowed to share their accounts with others.
17. Customers can send their comments via email to the company.
18. Customers can call Shipping Department to track their orders.
19. Customer records will be stored on a remote database server.
20. For security reasons, the maximum session duration cannot exceed 5 minutes.
In: Computer Science
Give an example of a class containing attributes and operations. Instantiate (create) an object of your class
In: Computer Science
Below is the code i got from another expert Q&A but im not allowed to use 'del' function because i didnt learn it.
+ I need to use recursion not list comprehenshion.
Please carefully go over the instructions
def add(vals1,vals2):
if (len(vals1))==0:
return []
else:
x =
vals1[0]+vals2[0]
del
vals1[0],vals2[0]
return [x]+add(vals1,vals2)
This is the question
Write a function add(vals1, vals2) that takes as inputs two lists of 0 or more numbers, vals1 and vals2, and that uses recursion to construct and return a new list in which each element is the sum of the corresponding elements of vals1 and vals2. You may assume that the two lists have the same length. For example: >>> add([1, 2, 3], [3, 5, 8]) result: [4, 7, 11] Note that: The first element of the result is the sum of the first elements of the original lists (1 + 3 –> 4). The second element of the result is the sum of the second elements of the original lists (2 + 5 –> 7). The third element of the result is the sum of the third elements of the original lists (3 + 8 –> 11) And this is why i have for the code. But i have not learned del function and im afraid i cant use it. im only allowed to use arithmetic operators: +, -, *, **, /, //, % boolean operators: <, >, <=, >=, ==, != comments and docstrings conditional statements: if, elif, else len() logical operators: and, or, not list operations: indexing, slicing, skip-slicing, concatenation, construction print() recursion string operations: indexing, slicing, concatenation, duplication type() def add(vals1,vals2):
In: Computer Science
How do we define the stack ADT, including its operations? Typed please.
In: Computer Science
In: Computer Science
Pretend that I (your professor) have enough free time to create an elaborate database for one of my fall face-to-face classes that contained the following information:
1) daily attendance
2) grades for every assignment and exam (including date of assignment)
3) age of students
4) every contact that each student made with me including email and office visit
5) voluntary class participation per student
6) whether students were freshmen, sophomore, junior, or senior
7) how many hours each student worked at a job each week
Write a 300-word essay discussing what ways I (the professor) could examine the relationship of this data to learn more about this class. Also, is there any additional data that would be interesting to have to examine this class?
Example: "I would like to analyze the relationship between class attendance and grade. I suspect that, on average, the students who do not show up to class are less likely to perform well..."
In: Computer Science
In your initial discussion post, recommend two options or approaches that cloud service providers can implement to protect subscriber data. Keep in mind, there is a balance to be struck between relying on trusted processes and security policies, and achieving operational agility --especially when subscriber data is at stake.
In: Computer Science
In: Computer Science
In: Computer Science
I kept getting errors trying to make this code to work, can someone show me what i am doing wrong?
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.*;
import java.util.*;
import java.nio.file.*;
import java.nio.charset.*;
import java.util.*;
//@WebServlet(name = "Assignment3_1", urlPatterns = { "/ReadFile"
})
public class ReadFile extends HttpServlet{
static Charset myCharset = Charset.forName("US-ASCII");
@Override public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException{
response.setContentType("text/html");
PrintWriter printer = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>");
out.println("Assignment 5.1");
out.println("</title>");
out.println("<h1>Is Bitcoin money?</h1>");
out.println("</head>");
out.println("<body>");
out.println("<div>");
writeAndReadFile(printer);
out.println("</div>");
out.println("</body>");
out.println("</html>");
}
private synchronized void writeAndReadFile(PrintWriter out){
try{
Path file = Paths.gets("C:/Temp/servlet1.dat");
List <String> linesReads = null;
// Read every line in the .dat file.
linesRead = Files.readAllLine(file, myCharset);
if(linesRead is null){
for(String line : linesRead){
out.println(line + "<br />\n");
}
}
}
catch(IOException e)
{
out.println("ERROR* >> "); out.println(e.toString());
}
}
}
In: Computer Science