Questions
Smart sensor nodes can process data collected from sensors, make decisions, and recognize relevant events based...

Smart sensor nodes can process data collected from sensors, make decisions, and recognize relevant events based on the sensed information before sharing it with other nodes. In wireless sensor networks, the smart sensor nodes are usually grouped in clusters for effective cooperation. One sensor node in each cluster must act as a cluster head. The cluster head depletes its energy resources faster than the other nodes. Thus, the cluster-head role must be periodically reassigned (rotated) to different sensor nodes to achieve a long lifetime of wireless sensor network. Discuss in detail what are the major attributes required for choosing the optimal cluster head and explain how the choosing of optimal cluster head helps in
extending the lifetime of the wireless sensor networks, rotating the cluster-head role among sensor nodes with suppression of unnecessary data transmissions. ()

In: Computer Science

A certain advertising company has commissioned a study to determine if a recent advertising campaign is...

A certain advertising company has commissioned a study to determine if a recent advertising campaign is effective for certain age groups. Researchers have created a data file (results.txt) which contains the results attained by the study. The first column is the subject’s name (you may assume there is no whitespace in any name) and the second column indicates if the subject has seen the advertisement in question (Y or y means yes, N or n means no). The third column specifies the subject's age and the last column (the 'score') specifies how favorably the subject views the product being advertised (from 0 to 100 with a score of 100 being most favorable). A example of the file results.txt is attached. You should download this file to a convenient place on your hard drive. Please note that the file is a sample only. Your program should work on any data file that is formatted in a similar way.

results.txt example file -

Bailey           Y 16 68
Harrison         N 17 71
Grant            Y 20 75
Peterson         N 21 69
Hsu              Y 20 79
Bowles           Y 15 75
Anderson         N 33 64
Nguyen           N 16 68
Sharp            N 14 75
Jones            Y 29 75
McMillan         N 19 80
Gabriel          N 20 62
Huang            Y 62 21
Willoughby       Y 58 29
Davis            N 33 65
McGregor         Y 41 55

Your assignment is to prompt the user to enter the full pathname to the data file on disk. If the file does not exist in the specified location, your program should exit with a suitable error message.

The first thing your program should do is output to the screen a copy of the data read in from the disk file. This is known as “echoing” the input data. Your program should then calculate and display the the following results:

 Average score for subjects under 18 who have not seen the ad.

 Average score for subjects under 18 who have seen the ad.

 Average score for subjects 18 to 35 (inclusive) who have not seen the ad.

 Average score for subjects 18 to 35 (inclusive) who have seen the ad.

 Average score for subjects over 35 who have not seen the ad.

 Average score for subjects over 35 who have seen the ad.

Display your results to two places of decimals, and write your program to automatically list your six calculated averages one to a line, in the order above, along with a suitable label for each result.

Finally, your program should calculate and display to two places of decimals the overall average score for all of the subjects surveyed. (Note: Mathematically, this is NOT the average of the six averages you calculated previously).

Warning: There may be no subjects in any given category (such as over 35s who have not seen the ad). If so you cannot calculate the average (because you would get a divide by zero error) so instead of the average for that category you should display “No data to report”.

In: Computer Science

What specific concepts from below do you find the most interesting and/or impactful to Cybersecurity? Explain...

What specific concepts from below do you find the most interesting and/or impactful to Cybersecurity? Explain the concept thoroughly, explain your position (e.g. why is it impactful to the field of Cybersecurity and/or so interesting to you) and provide several examples that support your argument.

Threats and Adversaries (threat actors, malware, natural phenomena)

Common Attacks

Malicious activity detection / forms of attack

Appropriate Countermeasures

Legal issues

Attack Timing (within x minutes of being attached to the net)

Covert Channels

Social Engineering

State, US and international standards / jurisdictions

Understand the interaction between security and system usability and the importance for minimizing the effects of security mechanisms.

In: Computer Science

why there exists more than one diagram to describe the system? Can we select only one...

why there exists more than one diagram to describe the system? Can we select only one to represent a system? Justify your answer.

In: Computer Science

Cyphers are hundred of years old. Using pseudo code and the a substitution cypher write a...

  1. Cyphers are hundred of years old. Using pseudo code and the a substitution cypher write a function to decode the following message and give the expected solution for the this message

            IUHHKIN NAHKK KBNHT VUOYNG

T

Z

I

J

K

M

W

A

O

P

Q

R

S

Y

U

V

L

H

G

N

E

C

D

B

F

X

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

In: Computer Science

Program in python an example code for the random variable (Bernoulli distribution), where the user informs...

Program in python an example code for the random variable (Bernoulli distribution), where the user informs the data and parameters necessary to generate the cumulative distribution function (CDF.)

In: Computer Science

Question 1: Please fetch the ‘Price’ column of the ford_escort.csv dataset. Count the number of rows,...

Question 1:

Please fetch the ‘Price’ column of the ford_escort.csv dataset.

Count the number of rows, and calculate the max, min, stdv and average of this column.

Show me the cars that their price is above the average.

Here is the link to download ford_escort.csv: https://www.dropbox.com/s/qczaguno5hfdico/ford_escort.csv?dl=0

Question 2:

The followings are the attributes of the wine quality dataset:

Input variables (based on physicochemical tests):

  1. fixed acidity
  2. volatile acidity
  3. citric acid
  4. residual sugar
  5. chlorides
  6. free sulfur dioxide
  7. total sulfur dioxide
  8. density
  9. pH
  10. sulphates
  11. alcohol

Output variable (based on sensory data):

12. quality (score between 0 and 10)

Please split the dataset into 80% for training and 20% for testing. Use two different machine learning algorithms to predict the labels for the testing segment (the 20% that you have separated for the testing).

Calculate the accuracy and see which algorithm provides better accuracy. You can use any ML algorithm, such as the decision tree, KNN, or any others.

Here is the link to download wine.csv:

https://www.dropbox.com/s/v0t9tb4gq8tiqh8/wine.csv?dl=0

In: Computer Science

6.23 LAB: Python insert/update sqlite3 datafiles Given is a Python program that connects to a sqlite...

6.23 LAB: Python insert/update sqlite3 datafiles

Given is a Python program that connects to a sqlite database and has one table called writers with two columnns:

  • name - the name of a writer
  • num - the number of works the writer has written

The writers table originally has the following data:

name, num
Jane Austen,6
Charles Dickens,20
Ernest Hemingway,9
Jack Kerouac,22
F. Scott Fitzgerald,8
Mary Shelley,7
Charlotte Bronte,5
Mark Twain,11
Agatha Christie,73
Ian Flemming,14
J.K. Rowling,14
Stephen King,54
Oscar Wilde,1

Update the Python program to ask the user if they want to update entries or add new entries. If the name entered already exists in the writers table then the database record is updated, overwriting the original contents. If the name does not exist in the writers table, then add a new record with the writer's name and number of works. The following TODO sections must be completed.

  • Check if a writer exists in the writers table
  • If the writer exists in the table, locate an entry to be updated by writer's name and update the writer's value for num
  • If the writer does not exist in the table, add a new entry in the writers table and provide the value for name and num

Ex: If the input is:

y
J.K. Rowling
30
y
Elton John
y
62
n

The output is:

(ID, Name, Num)
(1, 'Jane Austen', 6)
(2, 'Charles Dickens', 20)
(3, 'Ernest Hemingway', 9)
(4, 'Jack Kerouac', 22)
(5, 'F. Scott Fitzgerald', 8)
(6, 'Mary Shelley', 7)
(7, 'Charlotte Bronte', 5)
(8, 'Mark Twain', 11)
(9, 'Agatha Christie', 73)
(10, 'Ian Flemming', 14)
(11, 'J.K. Rowling', 30)
(12, 'Stephen King', 54)
(13, 'Oscar Wilde', 1)
(14, 'Elton John', 62)

In: Computer Science

look this code is a correct but i want modify it to allow the client to...

look this code is a correct but i want modify it to allow the client to have three attempts to login to the server

package hw2;

import java.net.*;
import java.util.Formatter;
import java.util.Random;
import java.util.Scanner;
import java.io.*;

public class Client {
   Socket server;
   int port;
   Formatter toNet = null;
   Scanner fromNet = null;
   Scanner fromUser = new Scanner(System.in);

   public Client() {
       try {
           // login at server at local host port 4000
           server = new Socket("localhost",4000);
           System.out.println("UserName: ");
           String user = fromUser.nextLine();
           System.out.println("Password: ");
           String pass = fromUser.nextLine();
           //to dedecate with the server
           fromNet = new Scanner(server.getInputStream());
           toNet = new Formatter(server.getOutputStream());
           toNet.format("%s\n", user);
           toNet.flush();
           toNet.format("%s\n", pass);
           toNet.flush();
           String response=fromNet.nextLine();
           if(!response.equals("valid") {
               System.out.println("Invalid Login!!");
           }else {
               // if login is successful vote at local host port 4001
               server = new Socket("localhost",4001);//establish new connection
               //establish a strem
               toNet = new Formatter(server.getOutputStream());
               System.out.prinln("Enter your vote 0-9: ");
                   String vote = formUser.nextLine();
                   toNet.format("%s\n", vote);
                   toNet.flush();
           }
              
       } catch (IOException ioe) { }
   }

   public static void main(String[] args) {
           new Client();
   }
}

package hw2;
import java.net.*;
import java.util.Formatter;
import java.util.Scanner;
import java.io.*;

public class ServiceServer0 extends Thread{//login multithreaded service
   Socket client;
   Scanner fromNet = null;
   Formatter toNet = null;
   private String login[][] = { { "user1", "pass1" }, { "user2", "pass2" }, { "user3", "pass3" }, { "user4", "pass4" },
           { "user5", "pass5" }, { "user6", "pass6" }, { "user7", "pass7" }, { "user8", "pass8" },
           { "user9", "pass9" }, };
   public ServiceServer0(Socket client) {
       this.client = client;
   }
   public void run() {
       System.out.println("Login Service: Serving client ...");
       try {
           fromNet = new Scanner(client.getInputStream());
           toNet = new Formatter(client.getOutputStream());
           String user = fromNet.nextLine(); //read the user
           String pass = fromNet.nextLine(); // read the pass
           String respone = " ";
           boolena fount = false;
           for (int i=0; i<long.length; i++) {
               if(login[i][0].equals(user) && login[i][1].equals(pass)) {
                   respone="valid";
                   found = true;
                   break; // to go out from for loop
               }
           }
          
           if(!found)
               response= "Invalid";
              
           toNet.format("%s\n", response);
           toNet.flush();
          
       }catch(IOException ioe) {}  
   }
}

package hw2;
import java.net.*;
import java.util.Formatter;
import java.util.Scanner;
import java.io.*;

public class ServiceServer2 extends Thread{//other services in similar manner
   Socket client;
   Scanner fromNet = null;
   Formatter toNet = null;

   public ServiceServer2(Socket client) {
       this.client = client;
   }
   public void run() {
       System.out.println("ServiceServer2: Serving client ...");
       try {
           fromNet = new Scanner(client.getInputStream());
           toNet = new Formatter(client.getOutputStream());

          
       }catch(IOException ioe) {}
      
   }

}

In: Computer Science

Implement a Lucky Draw game in which the user has to input an integer ‘input’ and...

Implement a Lucky Draw game in which the user has to input an integer ‘input’ and multiply it with a random integer to get the product ‘p’. Depending upon the value of ‘p’ display the prize amount. Use a suitable Java Collection object to store the prize amount for each value of ‘p’.

Design a generic stack data structure (not a Collection object) which can handle integer, double, character and any user-defined objects. Write a menu-driven Java program to test it.

In: Computer Science

Draw a diagram to show functional dependency and full functional dependency

Draw a diagram to show functional dependency and full functional dependency

In: Computer Science

What is IT governance referring to? Why is it important? How does one implement it? Answer...

What is IT governance referring to? Why is it important? How does one implement it? Answer these questions using a brief (two-page memo) to your boss – the president of your company.

In: Computer Science

A good security system must be secured at multiple layers such as 1) database, 2) computer...

A good security system must be secured at multiple layers such as 1) database, 2) computer and 3) network. Compare the differences among these three layers. Provide one security example for each and one scenario that involves all of them.

In: Computer Science

PostgreSQL 1. Write a query to join two tables employees and departments to display the department...

PostgreSQL

1. Write a query to join two tables employees and departments to display the department name, first_name and last_name, hire date, and salary for all managers who have more than 15 years of experience.

2. Write a query to join the employees and departments table to find the name of the employee including the name and last name, department ID and department name.

3. Write a SQL query to join three tables of employees, departments, and locations to find the names, including first and last name, job title, department name and ID, of employees working in London.

4. Write a query to concatenate the two tables of employees and yourself to find the employee id, last_name as Employee, and their manager_id and last name as Manager.

5. Write a query to connect to the employee table and to yourself to find the name, including first_name and last_name, and the hiring date for those employees who were hired after employee Jones.

6. Write a query to combine the two employee and department tables to get the department name and the number of employees working in each department.

7. Write a query to find employee ID, title and number of days he worked, who worked in department with ID 90.

8. Write a query to combine the two employee and department tables to display the department ID, department name, and manager name.

In: Computer Science

1- Write a c++ program that asks the user to enter his/her name using one variable...

1- Write a c++ program that asks the user to enter his/her name using one variable only. The name must
be then printed out in capital letter with the family name first and the last name second.

In: Computer Science