Questions
i j(i) i j(i) i j(i) i j(i) 0 -0.0499 7 -0.08539 13 0.144812 19 0.08021...

i

j(i)

i

j(i)

i

j(i)

i

j(i)

0

-0.0499

7

-0.08539

13

0.144812

19

0.08021

1

0.107506

8

0.062922

14

-0.0499

20

-0.30103

2

-0.06719

9

-0.04444

15

-0.18366

21

-0.33834

3

-0.04717

10

0.219422

16

-0.02898

22

0.058373

4

-0.09176

11

0.083849

17

0.08021

23

0.79083

5

-0.25918

12

-0.02261

18

-0.14271

24

0.130254

6

0.055643

25

-0.10177

  1. (3 points) Please encipher the following plaintext with Caesar Cipher and the encryption key of 10: TODAYISTUESDAY;
  1. (3 points) In a Caesar cipher, the encryption key is 5, and the ciphertext is LTTIQZHPBNYMDTZWJCFR, please decipher it;

  1. (6 points) Decipher the following ciphertext, which was enciphered using the Caesar cipher: TEBKFKQEBZLROPBLCERJXKBSBKQP.
  1. (4 points) Let k be the encipherment key for a Caesar cipher. The decipherment key differs; it is 26 – k. One of the characteristics of a public key system is that the encipherment and decipherment keys are different. Why then is the Caesar cipher a classical cryptosystem, not a public key cryptosystem? Be specific.

In: Computer Science

Python3 question. Suppose I have a undirect and unweighted graph with vertex list type, here is...

Python3 question.

Suppose I have a undirect and unweighted graph with vertex list type, here is the code of the graph.

graph = { "a" : ["c"],
          "b" : ["c", "e"],
          "c" : ["a", "b", "d", "e"],
          "d" : ["c"],
          "e" : ["c", "b"],
          "f" : []
        }

I want to use this to create a DFS method. How can I use stack only to finish the work?

In: Computer Science

Recursion java: 1. Write a recursive algorithm to add all the elements of an array of...

Recursion java:

1. Write a recursive algorithm to add all the elements of an array of n elements

2. Write a recursive algorithm to get the minimum element of an array of n elements

3. Write a recursive algorithm to add the corresponding elements of two arrays (A and B) of n elements. Store the results in a third array C

.4. Write a recursive algorithm to get the maximum element of a binary tree

5. Write a recursive algorithm to get the number of elements of a binary tree

In: Computer Science

Python3 question. Suppose I have a undirect and unweighted graph with vertex list type, here is...

Python3 question.

Suppose I have a undirect and unweighted graph with vertex list type, here is the code of the graph.

graph = { "a" : ["c"],
          "b" : ["c", "e"],
          "c" : ["a", "b", "d", "e"],
          "d" : ["c"],
          "e" : ["c", "b"],
          "f" : []
        }

I want to use this to create a BFS method. How can I use queue only to finish the work?

In: Computer Science

I am building a tik tac toe board using python and the function I am using...

I am building a tik tac toe board using python and the function I am using is not working to check to see if the board is full. I'll include the code for the board and the function to check if it is full. X's and O's are being inserted and the function is suppose to stop running when is_full(board) returns True. ch is either x or o

board = []

   for i in range(3):

    board.append([])

    for j in range(3):

    board[i].append(' ')

   return board

def is_full(board):

   """ Checking for board full """

   for lst in board:

    for ch in lst:

    if ch == ' ':

    return False

In: Computer Science

Please use python3 Create the function team_average which has the following header def team_average(filename): This function...

Please use python3

Create the function team_average which has the following header

def team_average(filename):

This function will return the average number of games won by the Red Sox from a text file with entries like this

2011-07-02      Red Sox @  Astros       Win 7-5
2011-07-03      Red Sox @  Astros       Win 2-1
2011-07-04      Red Sox vs Blue Jays    Loss 7-9

This function should create a file object for the file whose name is given by the parameter filename.

If the file cannot be opened, use a try/except statement to print an error message and don't do any further work on the file.

The function will count the number of lines and the number of games the Red Sox won and use these values to compute the average games won by the team.

This average should be expressed as an integer.

Test Code

Your hw2.py file must contain the following test code at the bottom of the file

team_average('xxxxxxx')
print(team_average('red_sox.txt'))

For this test code to work, you must copy into your hw2 directory the file red_sox.txt from /home/ghoffman/course_files/it117_files.

To do this go to your hw2 directory and run cp /home/ghoffman/course_files/it117_files/red_sox.txt .

Suggestions

Write this program in a step-by-step fashion using the technique of incremental development.

In other words, write a bit of code, test it, make whatever changes you need to get it working, and go on to the next step.

  1. Create the script hw2.py using nano or some other Unix text editor.
    Enter the header for team_average into the script.
    Under this header write the Python statement pass.
    Copy the test code above into the script.
    Make the script executable.
    Run the script.
    If all you see is None, proceed to the text step.
  2. Remove the pass statement.
    In its place write the function code to open the file for reading.
    This code should print an error message and exit the function if the file cannot be opened for reading.
    Run the script.
    You should see
    Cannot open xxxxxxx
    None
  3. Modify the function so it prints out the lines of the file.
  4. Modify the function to use the split string method to create a list from the from the different fields in a line. Print this list.
  5. For each line, get the value of the won_lost field and print it.
    This field is second to last entry in the list you created by using the split method.
    The lists will have different lengths, since some team have a single word as their name, and others have two words, e.g. White Sox.
    The easiest way to get the second to last field is to use a negative index.
    Print the value of won_lost field.
  6. Comment out or delete the line that prints the won_lost field.
    Initialize an accumulator to count the number of lines.
    Increment this accumulator inside the for loop.
    Return the total number of lines.
  7. Initialize an accumulator to count the number of Red Sox wins.
    In the for loop increment this accumulator every time the value of won_lost is "Win".
    Return the number of games won.
  8. Change the return statement so it returns integer percent of the number of games the Sox won.

Output

When you run the completed script, you should see

Error: Unable to open xxxxxxx
76

In: Computer Science

What are the security design principles? Explain each with an appropriate example.

What are the security design principles? Explain each with an appropriate example.

In: Computer Science

for C program 10 by 10 char array. char 0-9 as rows and char a-j as...

for C program 10 by 10 char array. char 0-9 as rows and char a-j as collumns.

In: Computer Science

Write a java method that creates a two dimensional char array after asking the user to...

Write a java method that creates a two dimensional char array after asking the user to input a String text and String key consisting of integers only, such that

int rows=(int)Math.ceil(text.length()/key.length()); // or int rows=(int)Math.ceil(text.length()/key.length()); ?

int columns= key.length();

int remainder= text.length() % key.length(); // such that the last row avoids taking an index beyond the string text by making columns - remainder

The method fills the 2d array with letters a String entered by the use (row by row). The method then shifts the columns of the array based on key.

After changing the columns, the method returns a String of all the characters in the 2d array but written column by column.

text = Sara;

key= 312

For example, the initial 2d array is

S A R
A

transformed into

R S A
A

The final retuned string is RSAA

In: Computer Science

Using what you know about how to take inputs and make outputs to the console, create...

Using what you know about how to take inputs and make outputs to the console, create a check printing application. Your application will read in from the user an employee's name and salary, and print out a Console Check similar to the following. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > | $1,000,000 | > > > > ___Pay to the Order of___ Johnny PayCheck > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Please only use technique from chapter 1 through 3 in C++ from control structure through object 9th edition

In: Computer Science

Library Management System allows the user to borrow and return the books. The book is identified...

Library Management System allows the user to borrow and return the books. The book is identified by book name, accession number, item category, due date, due time, and status. Before the user proceeds to borrow or return the books, they need to register for an account. Each user can have only one account. The user can be a staff or student. Each user is identified by ID number, name, school/department name, address. The books are arranged on a shelf. The shelf can be of two categories: open shelf or red spot. The user is allowed to reserve the book, in case, if the book is already borrowed by someone. While reserving a book, the user needs to specify the user name, ID number, book name, and accession number.

##Based on the above scenario, draw a Class Diagram. Your diagram should include attributes, methods and multiplicity.

In: Computer Science

File Compression - Student should submit a one-page paper summarizing the student’s research into compression programs...

File Compression - Student should submit a one-page paper summarizing the student’s research into compression programs associated with the filename extensions .zip, .sit, .sitx, and .exe, as well as whether those files would be self-extracting and which formats are associated with Windows and which with OS X. Also included should be a summary of at least two compression programs compatible with the computer the student uses most often, including their costs and capabilities

In: Computer Science

Write a multithreaded program that tests your solution to HW#1. You will create several threads –...

Write a multithreaded program that tests your solution to HW#1. You will create several threads – for example, 100 – and each thread will request a pid, sleep for a random period of time, and then release the pid. (Sleeping for a random period approximates the typical pid usage in which a pid is assigned to a new process, the process executes and terminates, and the pid is released on the process’ termination). On UNIX and Linux systems, sleeping is accomplished through the sleep() function, which is passed an integer value representing the number of seconds to sleep.

This is my HW#1 solution: public class PidManager{ private static final int MIN_PID = 300; private static final int MAX_PID = 5000; private static int[] pidArr; /* *This method is to allocate the *the array to store the pids. *@param none *@return int */ public static int allocate_map(){ pidArr = new int[MAX_PID - MIN_PID]; if (pidArr == null){ System.out.println("Not allocated."); return -1; } for (int i = 0; i < pidArr.length; i++) { pidArr[i] = 0; } System.out.println("Allocated."); return 1; } /* *This method is used to allocates and returns a pid. *@param none *@return int pidNum */ public static int allocate_pid(){ if (pidArr == null){ System.out.println("Pid manager is null "); return -1; } int pidNum = -1; for (int i = 0; i < pidArr.length; i++){ if (pidArr[i] == 0){ pidArr[i] = 1; pidNum = i + MIN_PID; break; } } if (pidNum == -1){ System.out.println("Cannot allocate Pid"); return -1; } System.out.println("Allocated Pid :" + pidNum); return pidNum; } /* *This method is used to release a pid. *@param int num *@return void */ public static void release_pid(int pidNum){ if (pidArr == null){ System.out.println("Pid manager is null. "); return; } if (pidNum < MIN_PID || pidNum > MAX_PID){ System.out.println("Pid is out of range, has to be in range from 300 to 5000"); } int newPid = pidNum - MIN_PID; if (pidArr[newPid] == 0){ System.out.println(pidNum + " is released."); return; } System.out.println("Releasing PID :" + pidNum); pidArr[newPid] = 0; } }

Thank you in advance.

In: Computer Science

Using Android Studio, create a one java android app that has 4 buttons:- Change Color Button...

Using Android Studio, create a one java android app that has 4 buttons:-

Change Color Button - When the Change Color button is clicked, it changes the current activity background to a randomly selected color

Speak Button - When the Speak button is clicked, it opens a new activity named SpeakActivity. On the SpeakActivity there are three controls: EditText, Button (Speak) and Button (Back). The Speak button uses the Text to Speech service to say the text entered in EditText. The Back button returns the user to the main/parent activity.

API Version Button - When the API Version button is clicked, display the Android API Version of the phone on a Toast in the current activity.

Serial Number Button - When the Serial Number button is clicked, send the serial number of your device to an email app as an implicit intent.

Layout Best practices & layout
  • all your screens look professional
  • all variables have meaningful names
  • all static strings are placed in the strings.xml file

Please show screenshots of your .xml and .java and the validated program.

In: Computer Science

With example, explain the different types of attack surface?

With example, explain the different types of attack surface?

In: Computer Science