Questions
2CCA : E-Discovery: Don't Be Afraid to Be Smart—Select While You Collect ? 2-3 paragraphs in...

2CCA : E-Discovery: Don't Be Afraid to Be Smart—Select While You Collect ? 2-3 paragraphs in length

In: Computer Science

Scientific Computing Course - please explain in detail PI has a value of 3.14159.... Round PI...

Scientific Computing Course - please explain in detail

PI has a value of 3.14159.... Round PI to 4 decimal places using chopping and then again using rounding.
What are the relative errors of using chopping and rounding?

In: Computer Science

TwoNumbersAddTo 1. write a class called TwoNumbersAddTo with a main method 2. the program asks for...

TwoNumbersAddTo 1. write a class called TwoNumbersAddTo with a main method 2. the program asks for a number (lets call it "goal"). 3. then the program reads at most 20 integers (i.e. any number of integers from 0 to 20) 4. the program stops reading when user enters 0 or user has entered 20 numbers. 5. program prints all the pairs that add up to goal. 6. Notice that if goal is 5, for example, 1 + 4 and 4 + 1 are the same pair. Your program should report only one. 7. The pairs should be printed such that the first number is in the same order in which it was entered. For example: % java TwoNumbersAddTo enter goal: 5 enter at most 20 integers, end with 0: 1 2 3 4 5 0 1 + 4 = 5 2 + 3 = 5 % java TwoNumbersAddTo enter goal: 5 enter at most 20 integers, end with 0: 4 3 2 1 0 4 + 1 = 5 3 + 2 = 5

In: Computer Science

Operating System: what is the difference between Synchronous & Asynchronous I/O.

Operating System:

what is the difference between Synchronous & Asynchronous I/O.

In: Computer Science

In the following class: public class Truth { private boolean yes_no; ... } Create constructor, setter...

In the following class:

public class Truth

{

private boolean yes_no;

...

}

Create constructor, setter and getter methods, and toString method.

In: Computer Science

write a C++ program that : 1. Perform a rot13 substitution 2. Perform a caesar encryption...

write a C++ program that :

1. Perform a rot13 substitution

2. Perform a caesar encryption given a dictionary

3. Perform a caesar decryption given a dictionary

4. Create a random caesar cipher dictionary

If user prints:

-r : Perform rot13 substitution

-g : generate a random caesar cipher dictionary.

-e: Encrypt using the caesar cipher

-d : Decrypt using the caesar cipher

The format for the caesar cipher dictionary is a file with 26 pairs of letters, one per letter of the

alphabet, in alphabetical order. Each pair has two letters: the plaintext letter and the ciphertext

letter. The pairs are separated by whitespace. While the dictionary contains only lowercase

letters, the mappings also apply for uppercase letters. Note that the ciphertext letters must be

unique; you cannot have two different plaintext letters that map to the same ciphertext letter.

You also cannot have a plaintext letter map to itself.

Example :   

as

bv

cg

dl

ep

.... 26 unique pair of letters

For all of the substitution operations, all upper and lower case letters on input should be

substituted (or rotated as the case may be) before being output. All other characters are simply

copied unchanged from input to output.

If the first argument is missing, the program should print MISSING COMMAND, then stop.

If the first argument is not one of the four listed above, print the first argument followed by a

space and NOT A VALID COMMAND, then stop.

For -r, there is an optional second argument. If provided, it is the name of the file to read from. If

it is not provided, the program should read from standard input. The output should be generated

to the standard output. If a filename is provided but the file cannot open for any reason, the

program should print the filename followed by a space and FILE COULD NOT BE OPENED,

then stop.

For -g, the dictionary should be printed to the standard output. You must ensure that each

plaintext letter maps to a unique ciphertext letter,

​and that no letter maps to itself.

For both -e and -d there is a required second argument, which is the filename of the dictionary.

If the second argument is missing, print the message NO DICTIONARY GIVEN, and stop. If the

dictionary cannot open for any reason, the program should print the filename followed by a

space and DICTIONARY COULD NOT BE OPENED, then stop.When reading the dictionary,

you must ensure that each plaintext letter maps to a unique ciphertext letter.

​If you find a case

where the dictionary does not contain a two-letter pair, print FORMATTING ERROR

followed by a space and the entry that you read, and stop. If you find a case where a

ciphertext is duplicated, the program should print DUPLICATE CIPHERTEXT L, where L is

the duplicated letter, and stop. If you find a plaintext that maps to the same letter in

ciphertext, the program should print MAPPING ERROR L, where L is the plaintext letter,

and stop.

​If you find a case where the dictionary is not in alphabetical order, you must print

MISSING LETTER L, where L is the missing letter, and stop.

Both -e and -d support an optional third argument, which is the file to read from. If it is not

provided, the program should read from standard input. The output should be generated to the

standard output. If a filename is provided but the file cannot open for any reason, the program

should print the filename followed by a space and FILE COULD NOT BE OPENED, then stop.

In all cases if there are too many command line arguments, your program should print TOO

MANY ARGUMENTS, then stop.

In: Computer Science

For this assignment, write a program that will generate three randomly sized sets of random numbers...

For this assignment, write a program that will generate three randomly sized sets of random numbers using DEV C++

To use the random number generator, first add a #include statement for the cstdlib library to the top of the program:

#include <cstdlib>

Next, initialize the random number generator. This is done by calling the srand function and passing in an integer value (known as a seed value). This should only be done ONE time and it MUST be done before actually getting a random number. A value of 1 (or any integer literal) will generate the same sequence of "random" numbers every time the program is executed. This can be useful for debugging:

srand(1);

To get a different series of random numbers each time the program is run, the actual time that the program is run can be passed as the seed value for the random number generator. This is done as follows:

srand(time(0));

If the time function is used, make sure to include the ctime library as well.

Note: the two srand instructions that are listed above are simple examples of how to use the instruction. In a program, only one version will be used.

Now that the random number generator has been initialized, a random number can be generated by calling the rand function:

num = rand();

The above line of C++ code will generate a "random" integer between 0 and RAND_MAX and saves the value in an integer variable named num. RAND_MAX is a pre-defined constant that is equal to the maximum possible random number. It is implementation dependent but is guaranteed to be at least 32,767.

Modulus division can be used to restrict the "random" integer to a smaller range:

num = rand() % 7;

will produce a value between 0 and 6. To change the range to 1 through 7, simply add 1:

num = rand() % 7 + 1;

To get random values that are within a specified range that starts at a value other than 0 or 1:

num = minimum_value + (rand() % (maximum_value - minimum_value + 1));

So, to get values within the range 3 - 17:

num = 3 + (rand() % (17 - 3 + 1));

Run 1 (using srand(5);) on Windows PC

There are 59 numbers in the first set of numbers.

 93 55 49 60 30 27 49 72 40 14 21 33 76 26  7 63  7 50 31 17
 92 93 11 36 49 52 83 22 31 51 69 59 10 53 15 22 87 83 34 86
  6 54 85 15 19 60 15 46 12 84  5 91 59 33 99 70  4 17 36

There are 235 numbers in the second set of numbers.

 66 38  1 36 10 89 90 93 51  6 35 50 68 46 82 75 35 82 60 53
 40  9 53 85 90 16 39 93 63 85 86 84 17 58 78 60 19 67 85  0
 26 71 80 74 78 85 43 73 33 29 39 56 61 75 92 83 55 86 19 66
 70 86 21 75 46 58 72  2 51 47 82 16 17 91 16 68 41 25  9 86
 51 33 67 89 61 46 73 82 24 91 49 43 54 27 32 72 76 96 16 97
 97  5 73 27 58 86 52 68  7 68 59 61 98  2 25 86 75 16 93 89
 32 82 68 74 21 71 20 67 94 58 30 70  0 72 24 95 86  8 87 36
 77 71 14 26 46  8 76  2 50 55 19 24 46 16 34 71 33 71 60 25
 58  5 93 11 86 34 72 32 33 80 42 30  0 10 38 58 67 98 45 26
 24 24 28 84 36 17  0  4 60 95 69 60 55 69 42 40 26 93 32 53
  0 28 64 74 75 17 30 72 30 54 48 37  8 39  4 44 65 81  5 43
 28 98 67 63 69 14 68 63 80 73 89 58 17 82 22

There are 205 numbers in the third set of values.

 81 40 35 33 69 58 56 79 66  0  2 24 65 35 50 84  7 26 85 35
 88 75 24 58 16 20 38 23 18  7 44 52 16 82 36 47 22 31 30 21
 78 59 54 88  0 17 90 81 87 73 59 58 60 94 49 92 22 29 81  1
 97 39 49 71 59 32 90 36 55 33 25 97 40 23 34 81 66 29 38 88
 35 88  2 55  5 45 44 94 34 83 26 91 16 85 10 64  1 66 28 96
 66 87 18 34 60 53 83 90 23 12 65 84 71 75 98 31 35  5 29 22
 72 51 22 37 38 51 62 26 56 12 23  1 22 27 76 85 34 61 92 48
 68 42 32 78 95 54  6 32 67 26 51 62 36 25 93 59 54 51 25 45
 15 54 55 73 19 51 24 36  2 79 19 97 23 66 91  5 91  1 27 20
 47 55 15 62 42 13 70 94 58 98 17  6 18 23 75 11 52 28 45 30
 89 95 32 95 49

In: Computer Science

Write a Scheme function that takes a list of integers and returns all odd integers on...

Write a Scheme function that takes a list of integers and returns all odd integers on the list in the original order:

(odd-numbers `(2 4 9 16 25 7)) (9 25 7)

Hint: 2 (remainder 13 5) 3

Please explain every step

In: Computer Science

Let X and Y be two arrays and you want to find their longest common sequence...

Let X and Y be two arrays and you want to find their longest common sequence (LCS). Describe how you can calculate it in a space complexity of O(min{|X|, |Y|}). NOT O(|X| * |Y|). Pseudocode is not necessary but a detailed explanation of the idea will be very helpful.

In: Computer Science

Let A and B be two stations attempting to transmit on an Ethernet. Each has a...

Let A and B be two stations attempting to transmit on an Ethernet. Each has a steady queue of frames ready to send; A’s frames will be numbered ?1, ?2 and so on, and B’s similarly. Let ? = 51.2 ???? be the exponential backoff base unit. Suppose A and B simultaneously attempt to send frame 1, collide, and happen to choose backoff times of 0 × ? and 1 × ?, respectively. As a result, Station A transmits ?1 while Station B waits. At the end of this transmission, B will attempt to retransmit ?1 while A will attempt to transmit ?2. These first attempts will collide, but now A backs off for either 0 × ? or 1 × ? (with equal probability), while B backs off for time equal to one of 0 × ?, 1 × ?, 2 × ? and 3× ? (with equal probability).
(a) Give the probability that A wins this second backoff race immediately after his first collision.
(b) Suppose A wins this second backoff race. A transmits ?2 and when it is finished, A and B collide again as A tries to transmit ?3 and B tries once more to transmit ?1. Give the probability that A
wins this third backoff race immediately after the first collision.
(c) What is the probability that A wins all the ? backoff races. (? is a given constant)
(d) Assume that there are 3 stations sharing the Ethernet. Will the chance for A to win all the backoff
races decrease or increase? Why?

In: Computer Science

create a class in C++ having the following 4 private members: one double variable representing the...

 
 
create a class in C++ having 
the following 4 private members:
one double variable representing the balance of a bank account
on string variable representing the bank account number
a function to deposit money from the bank account
a function to withdraw money from the bank account
the following 2 public members:
-two wrapper functions.
- one parameterless constructor
- one constructor initializing the account balance and account number

- sample:

#include <iostream>
using namespace std;

class account
{
    public:
    account();
    account(string s, double m);
    
    void setMoney(double b);
    void getMoney(double b);
    
    private:
    double money;
    string accountNo;
    
    void withdraw(double b);
    void deposit(double b);
    
};

    account::account()
    {
       money=0;
       accountNo="12345";
    }
    account::account(string s, double m)
    {
       money=m;
       accountNo=s;       
    }
    
    void  account::withdraw(double b)
    {
        if(money<b)
        {
           cout<<"not enough"<<endl;
        }
        else
        {
            money = money-b;
        }
        cout<<"withdraw your new balance is "<<money<<endl;
    }
    void account::setMoney(double b)
    {
        deposit(b);
    }
    void  account::getMoney(double b)
    {
        withdraw(b); 
    }
    
    void  account::deposit(double b)
    {
        money = money+b;
        cout<<"deposit: your new balance is "<<money<<endl; 
    }

int main() 
{
   account a;
   
    a.setMoney(1000);
    a.getMoney(500);
    
   account b("23456", 1234);
    b.setMoney(2000);
    b.getMoney(600);
   
   return 0;
}
 

In: Computer Science

UPS relies on an information system. Shipped items are characterized by a unique item number, weight,...

UPS relies on an information system. Shipped items are characterized by a unique item number, weight, dimensions, destination, and delivery date. Shipped items are received into the UPS system at a single retail center. Retail centers are identified by a unique ID and address. Sending Shipped items to their destination can be made through one or more standard UPS transportations. These transportations are identified by a unique schedule-Number, a type (e.g., flight, truck), and a delivery-Route.

Create an Entity Relationship diagram that captures this information about the UPS delivery system. Make sure to present the constraints.

In: Computer Science

What are the block tags and block indexes for the below 12-bit memory locations with 256-byte...

What are the block tags and block indexes for the below 12-bit memory locations with 256-byte cache?
a. 0001 0110 1010, for 16-byte blocks with direct-mapped cache
b. 0010 0011 1011, for 4-byte blocks with 4-way associative cache

In: Computer Science

Compare First Come First Served Scheduling, and Round Robin Scheduling. In your comparison, include discussions of...

Compare First Come First Served Scheduling, and Round Robin Scheduling. In your comparison, include discussions of their potential advantages and disadvantages, and which scheduling scheme performs better under what job load conditions. (You need to give proper reasons.)

In: Computer Science

Draw the memory address blocks (Tag, Index and Offset) for a direct mapped and N-way set...

Draw the memory address blocks (Tag, Index and Offset) for a direct mapped and N-way set associative cache organization for the below cache configurations. Round the cache size to nearest power of 2 (e.g., 1KB = 2^10) and assume 32-bit memory address.
a. 64KB cache, 32-byte block, N = 4
b. 1MB cache, 64-byte block, N=16
c. 32KB cache, 512-byte block, N=64

In: Computer Science