Questions
python and mathematical solution Assume that you design a new affine cipher, where you encrypt three...

python and mathematical solution

Assume that you design a new affine cipher, where you encrypt three letters at a time, where your alphabet is

{'A':0, 'B':1, 'C':2, 'D':3, 'E':4, 'F':5, 'G':6, 'H':7, 'I':8, 'J':9, 'K':10, 'L':11, 'M':12, 'N':13, 'O':14, 'P':15, 'Q':16, 'R':17, 'S':18, 'T':19, 'U':20, 'V':21, 'W':22, 'X':23, 'Y':24, 'Z':25,     ' ':26, '.':27, ',': 28, '!': 29, '?':30}.

In other words, you group your plaintext message in trigrams (i.e., three-character words) and encrypt each trigram of the plaintext separately using this affine cipher. For example, if the first three letters of a plaintext is “THE” then it will be encoded as follows

THE -> 19×31×31 + 7×31 + 4 = 18480.

If the number of letters in the plaintext is not a multiple of three, you pad it with the letter “X” at the end. Determine the modulus and the size of the key space.

In: Computer Science

Explain the symbiotic relationship between search engines, webmasters, and users.

Explain the symbiotic relationship between search engines, webmasters, and users.

In: Computer Science

STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop...

STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop a class, using templates, to provide functionality for a set of recursive functions. The functions specified as recursive must be written recursively (not iterativly). The UML class specifications are provided below. A main will be provided. Additionally, a make file will need to be developed and submitted. ● Recursion Set Class The recursion set template class will implement the template functions. recursionSet -length: int -*mySet: myType -MAX_VALUE = 500000 static const: int -LIMIT = 1000 static const: int +recursionSet() +recursionSet(const recursionSet&) +~recursionSet() +getSetLength() const: int +generateElements(int): void + getElement(int) const: myType +setElement(int, myType): void +readValue(const string) const: int +printSet() const: void +operator == (const recusrionSet&): bool +tak(myType, myType, myType) const: myType +printSeptenary(myType) const: void +squareRoot(myType, myType) const: myType -recSqRoot(myType, myType, myType) const: myType +recursiveSum() const: myType -rSum(int) const: myType +checkParentheses(string) const: bool -recChkPar(string, int, int) const: bool +recursiveInsertionSort(): void -recInsSort(int, int): void -insertInOrder(myType, int, int): voidYou may add additional private functions if needed (but, not for the recursive functions). Note, points will be deducted for especially poor style or inefficient coding. Function Descriptions • The recursionSet() constructor should set the length to 0 and mySet pointer to NULL. • The recusrsionSet(const recursionBucket&) copy constructor should create a new, deep copy from the passed object. • The ~recursionSet() destructor should delete the myType array, set the pointer to NULL, and set the size to 0. • The setElement(int, myValue) function should set an element in the class array at the given index location (over-writing any previous value). The function must include bounds checking. If an illegal index is provided, a error message should be displayed. • The getElement(int) should get and return an element from the passed index. This must include bounds checking. If an illegal index is provided, a error message should be displayed and a 0 returned. • The getSetLength() functions should return the current class array length. • The printSet(int) function should print the formatted class array with the passed number of values per line. Use the following output statement: cout << setw(5) << mySet[i] << " • "; Refer to the sample executions for formatting example. The readValue(string) function should prompt with the passed string and read a number from the user. The function should ensure that the value is 3 1 and £ MAX_VALUE. The function should handle invalid input (via a try/catch block). If an error occurs (out of range or invalid input) an appropriate message should be displayed and the user re- prompted. Example error messages include: cout << "readSetLenth: Sorry, too many " << "errors." << endl; cout << "readSetLenth: Error, value " << cnt << " not between 1 and " << numMax << "." << endl; • Note, three errors is acceptable, but a fourth error should end the function and return 0. The generateList(int) function should dynamically create the array and use the following casting for rand() to fill the array with random values. mySet[i] = static_cast(rand()%LIMIT); • • • The printSeptenary(myType) function should print the passed numeric argument in Septenary (base-7) format. Note, function must be written recursively. The recursiveSum() function will perform a recursive summation of the values in class data set and return the final sum. The function will call the private rSum(int) function (which is recursive). The rSum(int) function accepts the length of the data set and performs a recursive summation. The recursive summation is performed as follows: rSum ( position )= • { array[ 0] array[ position ] + rSum ( position−1) if position = 0 if position > 0 The tak(myType) function should recursively compute the Tak 1 function. The Tak function is defined as follows: tak ( x , y , z) = { z tak ( tak ( x−1, y , z) , tak ( y−1, z , x) , tak ( z −1, x , y ) ) 1 For more information, refer to: http://en.wikipedia.org/wiki/Tak_(function) if y≥ x if y < x• • The squareRoot(myType, myType) function will perform a recursive estimation of the square root of the passed value (first parameter) to the passed tolerance (second parameter). The function will call the private sqRoot(myType,myType,myType) function (which is recursive). The private recSqRoot(myType,myType,myType) function recursively determines an estimated square root. Assuming initially that a = x, the square root estimate can be determined as follows: recSqRoot ( x , a , epsilon) = • • • • • { 2 if ∣ a − x ∣ ≤ epsilon a 2 (a + x) sqRoot x , , epsilon 2 a ( ) if ∣ a 2 − x ∣ > epsilon The recursiveInsertionSort() function should sort the data set array using a recursive insertion sort. The recursiveInsertionSort() function should verify the length is valid and, if so, call the recInsSort() function to perform the recursive sorting (with the first element at 0 and the last element at length-1). The recInsSort(int, int) function should implement the recursive insertion sort. The arguments are the index of the first element and the index of the last element. If the first index is less than that last index, the recursive insertion sort algorithm is follows: ▪ Recursively sort all but the last element (i.e., last-1) ▪ Insert the last element in sorted order from first through last positions To support the insertion of the last element, the insertInOrder() function should be used. The insertInOrder(myType, int, int) function should recursively insert the passed element into the correction position. The arguments are the element, the starting index and the ending index (in that order). The function has 3 operations: ▪ If the element is greater than or equal to the last element in the sorted list (i.e., from first to last). If so, insert the element at the end of the sorted (i.e, mySet[last+1] = element). ▪ If the first is less than the last, insert the last element (i.e., mySet[last]) at the end of the sorted (i.e., mySet[last+1] = mySet[last]) and continue the insertion by recursively calling the insertInOrder() function with the element, first, and last-1 values. ▪ Otherwise, insert the last element (i.e., mySet[last]) at the end of the sorted (i.e., mySet[last+1] = mySet[last]) and set the last value (i.e., mySet[last]) to the passed element. The checkParentheses(string) function should determine if the parentheses in a passed string are correctly balanced. The function should call the private recChkPar(string, int, int) function (which is recursive) The recChkPar(string, int, int) function should determine if the parentheses in a string are correctly balanced. The arguments are the string, an index (initially 0), and a parenthesis level count (initially 0). The index is used to track the current character in the string. The general approach should be as follows: ◦ Identify base case or cases. ◦ Check the current character (i.e., index) for the following use cases: ▪ if str[index] == '(' → what to do then ▪ if str[index] == ')' → what to do then ▪ if str[index] == any other character → what to do then Note, for each case, increment the index and call function recursively.

In: Computer Science

Program must be OOP design.   Prompt the user to enter 10 doubles and fill an array...

Program must be OOP design.  

  1. Prompt the user to enter 10 doubles and fill an array
  2. Print the array
  3. Fill an array with 10 random numbers and print the array
  4. Sort the array -- then print
  5. Delete index[ 3] of the array and re-print the array

JAVA

This is my program so far. I am having trouble with my delete element method.



import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;


public class ArrayPlay {

    Random rand = new Random();//assign random number variable
    private double[] tenNumArray = new double[10];//initiate array containing 10 doubles.

    Scanner input = new Scanner(System.in);//create new scanner


    public Random getRand() {
        return this.rand;
    }

    public void setRand(Random rand) {
        this.rand = rand;
    }

    public double[] getTenNumArray() {
        return this.tenNumArray;
    }

    public void setTenNumArray(double[] tenNumArray) {
        this.tenNumArray = tenNumArray;
    } //end getters//setters

    //begin method
    public void fillArrayAndDisplay() {//begin prompt User method

        // #1 Prompt the user to enter 10 doubles and fill an array
        System.out.println("Enter ten elements to fill the array");
        for (int i = 0; i < this.tenNumArray.length; i++) {//for index equals 1 count plus 1 to 10
            this.tenNumArray[i] = input.nextDouble();//placing values index values into the array
        }//end for loop

        // #2 Print array
        System.out.println("The Numbers you entered into the array are");
        System.out.printf(Arrays.toString(this.tenNumArray)); // displays user filled array
    }//ends prompt User and print method


    // #3 Fill an array with 10 random numbers and print the array
    public void randomArrayAndDisplay() {   //begins random numbers and display array
        for (int i = 0; i < this.tenNumArray.length; i++) {
            this.tenNumArray[i] = rand.nextInt(10);//create the random numbers using Random class object. set to 10
        }
        System.out.println("\n The Randomly generated numbers are; ");
        System.out.printf(Arrays.toString(this.tenNumArray)); // displays random numbers
    }//ends random array and display method

    //  4. Sort the array -- then print
    public void sortNumberAndDisplay() {

        Arrays.sort(this.tenNumArray); //replaces your whole sort function
        System.out.println("\n The random numbers sorted are: ");
        System.out.printf(Arrays.toString(this.tenNumArray)); // replaces your display line
       }// end sort array method

    // #5. Delete index[ 3] of the array and re-print the array
    //begin delete element method
    public void deleteArrayElements(int index) {
        // If the array is empty
        // or the index is not in array range
        // return the original array
        if (this.tenNumArray == null
                || index >= this.tenNumArray.length || index < 0) {
            System.out.println("\n\n No deletion operation can be performed\n\n");

        } else {
            double[] tempArray = new double[this.tenNumArray.length - 1];

            // Copy the elements except the index
            // from original array to the other array
            for (int i = 0, k = 0; i < this.tenNumArray.length; i++) {

                // if the index is
                // the removal element index
                if (i == index) {
                    continue;
                }

                // if the index is not
                // the removal element index
                tempArray[k++] = this.tenNumArray[i];
            }

            // return the resultant array
            System.out.println(tempArray[4] + " \n delete num " + " ");

        }


    }

    public void loop(){
        fillArrayAndDisplay();//runs prompt user
        randomArrayAndDisplay();
        sortNumberAndDisplay();
        deleteArrayElements(3);//delete index 3
    }

}















In: Computer Science

Is there any benchmark for surveying the performance of security architecture? Test or evaluate the performance.

Is there any benchmark for surveying the performance of security architecture?

Test or evaluate the performance.

In: Computer Science

Describe the difference between name equivalence and structure equivalence and describe the difference between their use...

Describe the difference between name equivalence and structure equivalence and describe the difference between their use in modern programming languages. In your answer, clearly define both types of equivalence and show an example in a programming language for each type of equivalence.

In: Computer Science

Complete the following program. This program should do the following: 1. Creates a random integer in...

Complete the following program. This program should do the following:

1. Creates a random integer in the range 10 to 15 for variable: allThreads, to create a number of threads.

2. Creates a random integer for the size of an ArrayList: size.

3. Each thread obtains a smallest number of a segment of the array. To give qual sized segment to each thread we make the size of the array divisible by the number of threads: while(size%allThreads != 0)size++

4. The program gives random integers to the ArrayList: a.

5. To make sure the smallest number of the entire array is the same of your output, I made a method named: sequentialSmallest(a)

6. The program creates a number of threads. Each thread obtains the smallest number of a segment.

7. You need to complete the method: run() below.

Note: If your answer depends to a variable location that two or more threads are writing to it (changing its value), you must synchronize the variable.

import java.util.*;

public class Main {

public static void main(String[] args) {

  // This method is complete. Do not change it.

  new Main();

  }

  public Main() {

      Q1Threads();

}

private void Q1Threads(){

  // This method is complete. Do not change it.

    Random rand = new Random();

    int allThreads = rand.nextInt(5) + 10;

    int size = rand.nextInt(50) + 1;

    while(size%allThreads != 0)size++;

    ArrayList<Integer> a = new ArrayList<Integer>(size);

    for(int i = 0; i < size; i++)

      a.add(rand.nextInt(100) + 10);

    sequentialSmallest(a);

    MyThread[] thrds = new MyThread[allThreads];

    int segment = size/allThreads;

    for(int i = 0; i <allThreads ; i++) {

      int firstIndex = i * segment;

      int lastIndex = i * segment + segment -1;

      thrds[i] = new MyThread(a, firstIndex, lastIndex);

    }

   

    for(int i = 0; i < allThreads; i++)

      thrds[i].start();

   

    try{

      for(int i = 0; i < allThreads; i++)

        thrds[i].join();

    }catch(Exception e){

      System.out.println("Error: " + e);

      System.exit(0);

    }

    System.out.println("The smallest number is: " + Shared.result);

}

private static void sequentialSmallest(ArrayList<Integer> a) {

    // This method is complete. Do not change it.

    int smallest = a.get(0);

    for(int i = 0; i < a.size(); i++)

      if(a.get(i) < smallest)

        smallest = a.get(i);

   System.out.println("The list of random numbers is:");

    for(int i = 0; i < a.size(); i++)

      System.out.print(a.get(i) + ", ");

    System.out.println("\nThe smallest number from the sequential list is: " + smallest);

}

}

class MyThread extends Thread{

private ArrayList<Integer> a;

private int from, too;

public MyThread(ArrayList<Integer> a, int from, int too) {

    this.a = a;

    this.from = from;

    this.too = too;

}

public void run(){

    // Complete this method

}

}

Answer:

In: Computer Science

I'm having trouble with this program here's the problem: A milk carton can hold 3.78 liters...

I'm having trouble with this program

here's the problem:

A milk carton can hold 3.78 liters of milk.


Each morning, a dairy farm ships cartons of milk to a local grocery store.

The cost of producing one liter of milk is $0.38, and the profit of each carton of milk is $0.27.

Write a program that does the following:

  1. Prompts the user to enter the total amount of milk produced in liters.
  2. Outputs the number of milk cartons needed to hold milk. (Round your answer to the nearest integer.)
  3. Outputs the cost of producing the milk.
  4. Outputs the profit from producing the milk.

Here's the program:

#include <stdio.h>

int main(void){

const float cartoncapacity=3.78;

const float costperliter=0.38;

float profitpercarton=0.27;

float milkproduced, milkcost;

int cartonsneeded;

double profit;

printf("Enter, liters, the total quantity of milk produced:\n");

scanf("%f", &milkproduced);

cartonsneeded=((milkproduced+3.78)/cartoncapacity);

printf("Total number of cartons needed to hold:\n");

scanf("%d",&cartonsneeded);

milkcost=costperliter*milkproduced;

profit=profitpercarton*cartonsneeded;

  

printf("The cost of producing milk $ %f", &milkcost);

  

  

printf("Profit: $ %lf",&profit);

  

  

  

  

return (0);

}

In: Computer Science

1. What's the goal, requirement, and regulation for enterprise architecture? 2. How to survey the performance?

1. What's the goal, requirement, and regulation for enterprise architecture?

2. How to survey the performance?

In: Computer Science

Use PHP, javascript and a little bit of Html More focus on php Create a logout...

Use PHP, javascript and a little bit of Html

More focus on php

Create a logout page (for patients) in hotel management.

Please provide the screenshot of the output too (logout page).

Hint: the logout page should include like this thanks for visting etcetera.

Thanks in advance

In: Computer Science

Project 1: Cloud computing has become a viable and competitive option to the client/server networking model...

Project 1: Cloud computing has become a viable and competitive option to the client/server networking model due to its lower cost, scalability, and agility. A local business in your town has asked you to develop a full plan, an analysis to determine the requirement and a design to specify the input, output, and processing prerequisites. Since you are a knowledgeable systems analyst, you have decided to take the job. You understand all the benefits that come along with cloud computing. To assure a functional development life cycle, you have also decided to point out any negative issues with cloud computing such as security, untested new technologies, and training requirement. You are aware that it should take no more than seven weeks to complete the first three phases of SDLC.

Regardless of your topic, you must complete the first three phases of the system development life cycle (SDLC) process: 1. Analysis of the business case 2. Systems analysis a. Requirements modeling b. Data and procedures modeling c. Object modeling 3. Systems design a. Input design b. Output design c. User interface

Software required to complete the project include MS Word, MS Excel, PowerPoint, Visio (or similar package), MS Project, and a statistical package. You may use trial versions of MS Project and Vizio. When using Visio, MS Project, or similar software, ensure that you publish any work as either an image file (.jpeg, .png, etc.) or a pdf before incorporating it into your course project. This is to ensure that your instructor can view/grade your project.

In: Computer Science

Write a MIPS program to implement the Bubble Sort algorithm, that sorts an input list of...

Write a MIPS program to implement the Bubble Sort algorithm, that sorts an input list of

integers by repeatedly calling a “swap” subroutine.

The original unsorted list of integers should be received from the keyboard input. Your program should first prompt the user “Please input an integer for the number of elements:”. After the user enters a number and return, your program outputs message “Now input each element and then a return:”. For example, if the user enters 8 as the number of integers, and then the sequence of integers one by one: 6,5,9,1,7,0,-3,2,-8, it should display “The elements are sorted as: -8, -3, 0, 1, 2, 4, 6, 7, 9” (the output sequence of integers should be either space-separated or comma-separated).

The final sorted list (in increasing order) should be stored in the data area, that starts with the label "list:".

You should NOT implement a different sorting algorithm (e.g. mergesort or quick sort). You will receive 0% if your program does not call subroutine "swap", or if your sorted list is in decreasing order.

In: Computer Science

Hanover – Management Decision problems Snyders of Hanover, which sells about 80 million bags of pretzels,...

Hanover – Management Decision problems Snyders of Hanover, which sells about 80 million bags of pretzels, snacks chips, and organic snack items each year, had its financial department use spreadsheets and manual processes for much of data gathering and reporting. Hanover’s financial analyst would spend the entire final week of every month collecting spreadsheets from the heads of more than 50 departments worldwide. She would the consolidate and renter all the data into another spreadsheet, which would serve as the company’s monthly profit and loss statement. If a department needed to update its data after submitting the spreadsheet to the main office, the analyst had to return the original spreadsheet, the wait for the department to resubmit its data before finally submitting the updated data in the consolidated document.

1. Assess the impact of the above situation in delayed decision making and its business performance ?

2. As a manager what are your suggestions to improve the above process of data gathering and report generation In your view which type of Information System is required in the above scenario for dealing with the problem of online data processing and report generation ?

3. Why is it necessary for any organization to implement the Information System solution and how its is facilitating the organization in its digital transformation ?

In: Computer Science

Q-2) In a right triangle, the square of the length of one side is equal to...

Q-2) In a right triangle, the square of the length of one side is equal to the sum of squares of the lengths of the other two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message indicating whether the triangle is a right triangle or not.

In: Computer Science

Create a Crow’s Foot notation ERD to support the following business operations: Create a Crowsfoot notation...

Create a Crow’s Foot notation ERD to support the following business operations:

Create a Crowsfoot notation ERD to support the following business operations: -

A friend of yours has opened Marshfield Electronics and Repairs (MER) to repair smartphones, laptops, tablets, and MP3 players. She wants you to create a database to help her run her business.

When a customer brings a device to MER for repair, data must be recorded about the customer, the device, and the repair (also referred to as repair request). Completing each repair request can involve multiple services (e.g. glass replacement, battery replacement, cleaning. Some services require parts.

The customer’s name, address, and a contact phone number must be recorded.

For the device to be repaired, the type of device, model, and serial number are recorded (or verified if the device is already in the system).

Each repair request is given a reference number, which is recorded in the system along with the date of the request, and a description of the problem(s) that the customer wants fixed.

For each Service, there is a service ID number, description, and charge (amount charged for the service)

Part number, Part description and Price are stored for each part.

Each repair request is associated with only one customer. A customer may submit multiple repair requests.

Each repair request is for the repair of one and only one device. It is possible for a device to be brought to the shop for repair many different times,

Completing a repair request may require the performance of many services. Each service can be performed many different times over multiple repairs, but each service is only performed once during the repair of a device.

Each service may or may not require parts. A service may require many parts. A part is used in one or many services. It is also possible that a part is not used in any service.

Hint: Make sure you convert all M-N relationship to two 1-M relationships to receive a full mark.

In: Computer Science