Questions
Create a Java program. The class name for the program should be 'EncryptText'. In the main...

  1. Create a Java program.
  2. The class name for the program should be 'EncryptText'.
  3. In the main method you should perform the following:
    • You should read a string from the keyboard using the Scanner class object.
    • You should then encrypt the text by reading each character from the string and adding 1 to the character resulting in a shift of the letter entered.
    • You should output the string entered and the resulting encrypted string.

Pseudo flowchart for additional code to be added to the program:

  1. After the input string is entered from the keyboard add the following logic.
  2. Create a string to hold the lowercase version of the input string.
  3. Create a result string to hold the encrypted characters.
  4. Loop through each character of the lower case string.
  5. The code should read each character of the input string and add 1 to the character so that the character is shifted one position higher in the character sequence.
  6. For instance if the input character is an 'a' then the character should be shifted to a 'b'. A 'b' would become a 'c', a 'c' would become a 'd', etc.
  7. After you add 1 to the character you should concatenate the character to a result string.
  8. Output the string input and the result string.

In: Computer Science

How can I do this in python ??? In order to create the Exam Result objects...

How can I do this in python ???
In order to create the Exam Result objects correctly, one must find the student object and the subject object that the exam result should refer to. The distributed code contains O (n) methods that perform sequential searches to find them in the lists. Create new implementations of oving7. find _student and oving7.find_ topic that is more effective.

oving7. find _student:

def find _student (student no, student list):
     for student in student list:
         if student.get_studentnumber () == studentnr:
             return student
     return None

oving7.find_ topic:

def find _ topic (topic code, topic list):
     for subject in subject list:
         if topic.get_ topic code () == topic code:
             return topic
     return None

In: Computer Science

Situation: You suspect there is a virus on your computer.  However, you cannot seem to remove this...

Situation: You suspect there is a virus on your computer.  However, you cannot seem to remove this virus using standard software tools.  During your analysis of the computer system, you find some interesting information in the Master Boot Record that does not appear to be part of the original boot loader process.

Question: If this is the case, what kind of virus might this be, where do you think it resides, and what steps could you take to erase the virus?

In: Computer Science

Suppose that the packet length is L= 1000 bytes, and that the link transmission rate along...

Suppose that the packet length is L= 1000 bytes, and that the link transmission rate along the link to router on the right is R = 1000 Mbps.

1. What is the transmission delay (the time needed to transmit all of a packet's bits into the link) (in milliseconds)?

I know that the answer to 1. is ---> The link transmission delay = L/R = 8000 bits / 1000 Mbps = 0.008 msec.

2. what is the maximum number of packets per second that can be transmitted by the link?

I need to know how to calculate 2. above, please help.

In: Computer Science

a) The capacity of a memory chip is specified as 64K x 8 bits. Find out...

a) The capacity of a memory chip is specified as 64K x 8 bits. Find out the address lines & the data lines for the chip. b) A memory block has 20 address lines & 16 data lines. Specify its capacity c) Assume a 32-bit microprocessor is to be used in a computer system, what is the size of its address bus, data bus, control bus and the registers if it needs to access up to 32GB of data? Assume that each memory locations can store a 32-bit word.

In: Computer Science

An IPv4 Layer 3 router that uses 32-bit host addresses has four output interfaces, which are...

An IPv4 Layer 3 router that uses 32-bit host addresses has four output interfaces, which are numbered 0 through 3. Packets are forwarded to the link interfaces using the following rules:

Destination Address Range   Output Link Interface
00000010 00000000 00000000 00000000
through
00000010 00011111 11111111 11111111   0
00000010 00100000 00000000 00000000
through
00000010 00100001 11111111 11111111   1
00000010 01000010 00000000 00000000
through
00000010 01000011 11111111 11111111   2
all other addresses 3

a. Construct a forwarding table that has no more than five entries and uses longest prefix matching.

b. Describe how your forwarding table determines the appropriate link interface
For the following incoming datagram destination addresses, describe which rule is used, and to which port interface the datagram is forwarded:
i) 00000010 00001000 11000011 00111100 (binary octets)
ii) 00000010 00001000 11000011 00111100 (binary octets)
iii) 10.0.3.1 (base-10 octets)
iv) 2.65.3.41 (base-10 octets)
v) 2.34.225.200 (base-10 octets)

In: Computer Science

You must write functions permute(...) and permuteAux(...) by analogy with the the functions enumerate(....) and enumAux(....)....

You must write functions permute(...) and permuteAux(...) by analogy with the the functions enumerate(....) and enumAux(....). Basically, the changes are to implement the "without replacement" condition: you must keep track of which letters have been used using a Boolean list in previous stages of the recursion (e.g., B[0] will be true if at an earlier stage of the recursion, 'A' has already been inserted into X; simply don't do the recursive call if that letter has been used).

Print out the sequences for permute(4,3)

CODE FOR enumerate and enumAux


letter = [chr(i) for i in range(ord('A'),ord('Z')+1)] =

def enumerate(N,L):
X = [0] * L
enumAux(N,X,0)
  
def enumAux(N,X,I):
if(I >= len(X)):
print(X)
else:
for j in range(N):
X[I] = letter[j]
enumAux(N,X,I+1)
  
enumerate(3,2)

OUTPUT:

['A', 'A']
['A', 'B']
['A', 'C']
['B', 'A']
['B', 'B']
['B', 'C']
['C', 'A']
['C', 'B']
['C', 'C']

In: Computer Science

How do you write this code in JavaScript inside the head? Prompt the user for their...

How do you write this code in JavaScript inside the head?

  • Prompt the user for their first name.
  • Remember you must save the value that the user enters so that you can use that value, therefore the prompt must be in an assignment statement.
  • Prompt the user for their last name.
  • Have an alert box pop up that contains the first name followed by a space and then the last name followed by a short message that you make up.
  • Hint: you will concatenate the value of the variable used to store the first name with a string that contains a space, them the value of the variable that contains the last name and then the string that contains the message. Variable names are not enclosed in quotes – we want the value of the variable, not the name of the variable to appear. Strings are enclosed in quotes,

In: Computer Science

Write a Python module that must satisfy the following- Define a function named rinsert. This function...

Write a Python module that must satisfy the following-

Define a function named rinsert. This function will accept two arguments, the first a list of items to be sorted and the second an integer value in the range 0 to the length of the list, minus 1. This function shall insert the element corresponding to the second parameter into the presumably sorted list from position 0 to one less than the second parameter’s index.  

Define a function named rinsort. This function will accept two arguments, the first a list of items to be sorted and the second an integer value in the range 0 to the length of the list, minus 1. This function shall sort the elements of the list from position 0 to the position corresponding to the second parameter, in ascending order using insertion sort. This function must be recursive.

In: Computer Science

Provide at least three (3) best practices when creating methods in C# and explain why they...

Provide at least three (3) best practices when creating methods in C# and explain why they are "best.

In: Computer Science

Task #1 Develop a recursive method to reverse a list Develop a method with the prototype...

Task #1 Develop a recursive method to reverse a list Develop a method with the prototype public static void reverse (ArrayList inputList) based on selecting the first list element as the head and the remaining list as its tail. Here is the recursive design. 1) Base case: The problem is trivial when the list size is 0 or 1. 2) Decomposition: For lists with size > 1: a) Extract its head (element) and leave the tail (the input list with the head removed). You can look up the method that does this for the List interface. b) Make a recursive call to obtain the tail reversed. Page 2 of 3 3) Composition: Append the extracted head element to the reversed tail obtain the original list reversed. Task #2 Develop a recursive method to find the maximal element Note that this is not possible unless the list elements are comparable to each other. Java provides a generic Interface for this called Comparable. Based on this, develop a method with the following prototype public static > E max(List inputList) You can use the same problem decomposition technique as in Task #1. Think about how the composition of result should be made. Task #3 Develop a recursive method to sum the list elements Obviously, this is not possible unless the list elements are of numeric type. Develop a recursive summing method with the prototype public static double sum (List inputList) Task #4 Use command line arguments to supply the list elements Use the following main() method: public static void main(String args[]) { ArrayList argList = new ArrayList<>(); ArrayList numericArgs = new ArrayList<>(); for (String s : args) { argList.add(s); try { numericArgs.add(Double.parseDouble(s)); } catch (NumberFormatException e) { System.out.println(e.getMessage() + "is not numeric...skipping"); } } System.out.print("Command line arguments before reversal: "); for (int i=0; i

In: Computer Science

Write a program that calculates the average of a group of test scores, where the lowest...

Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: void getScore() should ask the user for a test score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the five scores to be entered. void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores. int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop.

Please post the program working as well. Thank you

In: Computer Science

How to prove f(n)=O(n) for any integer ⩾1, if f(1)=1 and f(n)=2f(⌊n/2⌋)+1 for n⩾2? Do you...

How to prove f(n)=O(n) for any integer ⩾1, if f(1)=1 and f(n)=2f(⌊n/2⌋)+1 for n⩾2?

Do you need induction? If so, how do you do it?

In: Computer Science

Write a program that uses nested loops to collect data and calculate the average rainfall over...

Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month.

After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.

Input Validation: Do not accept a number less than 1 for the number of years. Do not accept negative numbers for the monthly rainfall.

Please post the program working as well. Thank you

In: Computer Science

A painting company has determined that for every 110 square feet of wall space, one gallon...

A painting company has determined that for every 110 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $25.00 per hour for labor. Write a modular program that allows the user to enter the number of rooms that are to be painted and the price of the paint per gallon. It should also ask for the square feet of wall space in each room.

It should then display the following data:

  • The number of gallons of paint required
  • The hours of labor required
  • The cost of the paint
  • The labor charges
  • The total cost of the paint job

Input validation: Do not accept a value less than 1 for the number of rooms. Do not accept a value less than $10.00 for the price of paint. Do not accept a negative value for square footage of wall space.

In: Computer Science