Questions
In the java programming language. How would you find if numbers in an array element add...

In the java programming language.

How would you find if numbers in an array element add up to a certain sum so for example if my array element consists of: INPUT: 200, 10, 50, 20 and my output asks if these elements add to: 210? YES (200+10) 260? YES (200+10+50) 30? NO What method would you suggest to look through the elements in an array (which im going to add through a text file) and determine if these sums exist in O(n^2)?

In: Computer Science

State whether each of the following is true or false. Justify your answer! a. There are...

State whether each of the following is true or false. Justify your answer!

a. There are infinitely many finite languages.

b. Union of any two languages over alphabet {0, 1} is always regular.

c. The value of n3 +6n2 +5n is divisible by 6 for any integer n>0. Provide a proof.

d. Single state NFA can recognize only finite languages (languages with finitely many strings)

e. Intersection of any language and its complement is always regular.

In: Computer Science

Multiple choice Consider the following ORACLE relations : One (x, y) = {<2, 5>, <1, 6>,...

Multiple choice

Consider the following ORACLE relations :
One (x, y) = {<2, 5>, <1, 6>, <1, 6>, <1, 6>, <4, 8>, <4, 8>}
Two (x, y) = {<2, 55>, <1, 1>, <4, 4>, <1, 6>, <4, 8>, <4, 8>, <9, 9>, <1, 6>}

Consider the following two SQL queries SQ1 and SQ2 :

SQ1 : SELECT * FROM One)            
          EXCEPT            
         (SELECT * FROM Two);
  
SQ2 : SELECT * FROM One)            
          EXCEPT ALL           
         (SELECT * FROM Two);

2 and 2 respectively

1 and 2 respectively

1 and 1 respectively

2 and 1 respectively

In: Computer Science

5. What is the Netflix churn rate and what are the reasons behind this rate?

5. What is the Netflix churn rate and what are the reasons behind this rate?

In: Computer Science

Design a strategy that minimizes the expected number of questions you will ask in the fol-...

Design a strategy that minimizes the expected number of questions you will ask in the fol- lowing game. You have a deck of cards that consists of one one, two twos, three threes, and so on up to nine nines for a total of 45 cards. Someone draws a card from the shuffled deck and looks at its value (hiding it from you). The goal is to determine the value of the card through asking a series of questions, each of which must be answerable with “yes” or “no” (such as “Is the card a nine?”).

To answer this question, you should express your strategy as a decision tree. You may either explicitly draw the decision tree or describe its construction in sufficient detail so that I could draw it from your description.

Furthermore, briefly explain why this minimizes the expected number of questions you will ask in this game. You are not required to give a formal proof.

Hint: The first question to ask in the optimal decision tree is “Is the card one of {4, 5, 9}?” Equivalently, the question can be “Is the card one of {1, 2, 3, 6, 7, 8}?”

In: Computer Science

For the computer forensics case, identify what evidence the forensics experts were able to gather. What...

  1. For the computer forensics case, identify what evidence the forensics experts were able to gather.
  2. What important questions should the security incident response form answer.
  3. Why is it important to include a time/date stamp in the security incident response form?

In: Computer Science

What is a sensible approach to building and validating a predictive model

What is a sensible approach to building and validating a predictive model

In: Computer Science

//JAVA //basic please for learning programming 2. Thank you. Write the Class Variables Class Box is...

//JAVA
//basic please for learning programming 2. Thank you.

Write the Class Variables
Class Box is to have the following private data members:

  • height of type double
  • width of type double
  • length of type double

Write the following Overridden Method
Class Box is to have an overridden equals() method that does the following:​​​​

  • tests to see if the parameter represents an object (null test)
  • tests to see if the parameter object is of the same class type as the calling object (class test)
  • determines if the calling object and the parameter object store identical data values for the corresponding data members (variable to variable test)

Write the Get and Get Methods
Class Box is to have standard get/set methods for each data member
Write the following Auxiliary Method
Class Box is to have an auxiliary method getVolume( ). The method is to have an access of public and return a value of type double. The method is to do the following:

  • calculate and return the volume of the box
  • volume is calculated by multiplying the length of the box by the width of the box by the height of the box

Write the Constructors
Class Box is to have two constructors with the following specifications:

  • a no-arg constructor that initializes each double data member to zero
  • a constructor that takes three parameters, each representing one of the class data members. the arguments are to be listed in the order of (height, width, length)

Class: Box
Write the class header
Write the following Overridden Method
Class Box is to have an overridden toString() method that does the following:

  • displays the following information in the format presented:

Height: display height of the object
Width: display the width of the object
Length: display the length of the object
Write the following application class: BoxApp.

Class BoxApp is to do the following:

  • create an object of type Box named smallBox that has a height of 3, a width of 4 and a length of 5;
  • create an object of type Box named mediumBox that has a height of 6, a width of 7 and a length of 8;
  • create an object of type Box named unknownBox that has a height of 0, a width of 0 and a length of 0;
  • test to see if smallBox equals unknown box. If they are equal, display the word true. If they are not equal, display the word false.
  • output the following information for smallBox

Height: the value of the height property
Width: the value of the width property
Length: the value of the length property

In: Computer Science

Convert UTF-8 to UTF-16 and Back Write two Java programs and verify that they work. Program...

Convert UTF-8 to UTF-16 and Back

Write two Java programs and verify that they work.

Program 1 should:

  • Read a UTF-8 encoded text file
  • Print to the console the hex values for the bytes it read in.
  • Convert the text to UTF-16
  • Print to the console the hex values for the converted bytes
  • Write the UTF-16 text to a file

Program 2 should do the same as program 1, except program 2 goes from UTF-16 to UTF-8

Submit:

  1. UTF8ToUTF16.java
  2. UTF16ToUTF8.java
  3. A sample utf8 input file
  4. A sample utf 16 output file
  5. A sample utf 16 input file
  6. A sample utf 8 output file
  7. A screenshot of your computer running program 1
  8. A screenshot of your computer running program 2

import java.io.*;

public class WriteUTF8 {
  
   public static void main(String[] args) {
       File file = new File("utf8_output.txt");
       FileOutputStream fs= null;
       try {
           fs = new FileOutputStream(file);
       }
       catch (FileNotFoundException fnfe) {
           System.err.println("file not found");
       }
       try {
           fs.write("Фёдор".getBytes("UTF-8"));
           fs.close();
       }
       catch(IOException ioe){
           System.err.println("unable to write to file");
       }
   }
}
---

import java.io.*;

public class WriteUTF16 {
  
   public static void main(String[] args) {
       File file = new File("utf16_output.txt");
       FileOutputStream fs= null;
       try {
           fs = new FileOutputStream(file);
       }
       catch (FileNotFoundException fnfe) {
           System.err.println("file not found");
       }
       try {
           fs.write("Фёдор".getBytes("UTF-16"));
           fs.close();
       }
       catch(IOException ioe){
           System.err.println("unable to write to file");
       }
   }
}
--

In: Computer Science

1a) Write the start of the class declaration for a node in a linked list (give...

1a) Write the start of the class declaration for a node in a linked list (give the name of the class and the instance variables). The name of the node should be SpecialNode. The data in each SpecialNode will include both a String and a Song object.

b)Using the SpecialNode class you created in question above, write a constructor forSpecialNode that has three parameters and initializes all the SpecialNode instance variables.

c) Write a line of code to instantiate a SpecialNode object to initialize the SpecialNodeinstance variables. Use the constructor you wrote in the previous question.

Song rockstar = new Song("Rockstar", 5);

SpecialNode sn = ___________________________________ ;

In: Computer Science

I am using NetBeans IDE Java for coding. I would like the code to be commented...

I am using NetBeans IDE Java for coding. I would like the code to be commented for a better understanding.

1. Implement a class Robot that simulates a robot wandering on an infinite plane. The robot is located at a point with integer coordinates and faces north, east, south, or west.

Supply methods:

public void turnLeft()

public void turnRight()

public void move()

public Point getLocation()

public String getDirection()

The turnLeft and turnRight methods change the direction but not the location. The move method moves the robot by one unit in the direction it is facing. The getDirection method returns a string "N", "E", "S", or "W".

In: Computer Science

1. Provide an explanation of the network detection methods in the chapter, give an example of...

1. Provide an explanation of the network detection methods in the chapter, give an example of their importance and discuss the issue(s) associated with each method.


In: Computer Science

Operating systems typically split functionality into layers. Explain the advantages and disadvantages of the structure of...

Operating systems typically split functionality into layers. Explain the advantages and disadvantages of the structure of software as layers in distributed systems.

In: Computer Science

Q2) Using the program in Figure 2, identify the values of pid at lines A, B,...

Q2) Using the program in Figure 2, identify the values of pid at lines A, B, C, and D. (Assume that the actual pids of the parent and child are 2600 and 2603, respectively.) Give a brief explanation.

#include <sys/types.h> #include <sys/wait.h> #include <stdio.h> #include <unistd.h>

int main() { pid_t pid, pid1; /*fork a child process*/

pid = fork(); if (pid < 0) { /* error occurred*/ fprintf(stderr, "Fork Failed"); return 1; } else if (pid == 0) { /*child process*/ pid1 = getpid(); printf("child: pid = %d", pid); /* A */ printf("child: pid1 = %d", pid1); /* B */ } else { /*parent process*/ pid1 = getpid(); printf("parent: pid = %d", pid); /* C */ printf("parent: pid1 = %d", pid1); /* D */ wait(NULL); }

return 0; }

Figure 2 - What are the pid values displayed?

In: Computer Science

Question 1 What Unix command can be used to change the access permission of a file...

Question 1

  1. What Unix command can be used to change the access permission of a file ?   and how ?

  1. Explain how pipe works in Unix. Give one example; Explain how redirect works in Unix and give an example.

  1. Explain the structure of Unix file system and how absolute and relative paths work

  1. What is UML ?   Briefly explain two types of diagrams in UML.

  1. Briefly explain two types of testing methods for software development and the major stages in software development cycles

In: Computer Science