Questions
Parameter Mystery. Consider the following program. List below the exact output produced by the above program...

Parameter Mystery. Consider the following program. List below the exact output produced by the above program (we do not claim that every line of output makes sense ;-).

public class Mystery

{ public static void main(String[] args)

{ String john = "skip";

String mary = "george";

String george = "mary";

String fun = "drive"; statement(george, mary, john);

statement(fun, "george", "work");

statement(mary, john, fun);

statement(george, "john", "dance"); }

public static void statement(String mary, String john, String fun)

{ System.out.println(john + " likes to " + fun + " with " + mary); } }

I know the output is

george likes to skip with mary
george likes to work with drive
skip likes to drive with george
john likes to dance with mary

But I don't know why- can I get an explanation as to why???

In: Computer Science

Read Ch. 3. Using the C++ editor, type the following program: #include <iostream> #include <string> using...

  1. Read Ch. 3. Using the C++ editor, type the following program:

#include <iostream>

#include <string>

using namespace std;

int main ()

{

       //declarations

string name;

       //input

cout <<"Enter your first name" << endl;

       cin >> name;

       //output

       cout << "Hello " << name << "! " << endl;

       return 0;

}

  1. Compile and run. What does the cin statement do?
  2. What does the cout statement do?
  3. Is name a variable or a constant?
  4. What type is name?
  5. Add the following line to the declaration statements:

int age;

Add the following lines to your program:

cout << “Enter your age” << endl;

cin >> age;

Compile and Run.

What type is age? Describe this type.

  1. Add a line to print the age to the screen. Compile and Run.
  2. Add the following line to the declaration statements:

float bodyTemp;

              Add the lines to input and out your body temperature. Compile and run.

              What type is bodyTemp? Describe this type.

  1. Add the appropriate declaration, input and output statement for each of the following:

Height (hint, use two variables)

Weight

Sex (hint, use the char type)

Last name

  1. Turn in:
    1. The final program
    2. The final output

Answers to these questions only:

  1. What is the integer data type and how is it declared in C++?
  2. Give an example of where the integer type might be used.
  3. What is the real data type and how is it declared in C++?
  4. Give an example of where the real type might be used.
  5. What is the string data type and how is a string declared in C++?
  6. Give an example of where the string type might be used.
  7. What is the boolean type and how is an boolean declared in C++?
  8. Give an example of where the boolean type might be used.

In: Computer Science

Give the value of x (x is an integer and assume integer arithmetic for all operations)....

Give the value of x (x is an integer and assume integer arithmetic for all operations).

________ 1.             x = 12 - 4 * 2 - 8;

________ 2.             x = 24 / 2 + 1 * 4;

________ 3.             x = 12 - 9 + 4 * 2 + 3 ^ 4;

________ 4.             x = 24/(3 + 2) * 4;

________ 5.             x = 2 * (5 - 3) + 7;

________ 6.             x = 12 - (15/5 - 2) * 5;

________ 7.             x = 20 - 15/((5 - 2) * 5);

________ 8.             x = 13 % 5;

Evaluate the following equations, given A = 12, B = 3, C = 6, D = 2 ,A, B, C, and D are integers, and all operations are integer

________ 9.             x = A + B/C - D^2.;

________ 10.         x = A + B/(C - D^2);

________ 11.         x = (A + B) % C;

________ 12.         x = (A + B)/C - D^2;

Assume the following order of operations:

!

&&

||

Give the value of x,

given A = FALSE, B = FALSE, C = FALSE, D = TRUE. E = 10, F = 15

________ 13.         x = A && B

________ 14.         x = C || D

________ 15.         x = !C

________ 16.         x = !(A && D)

________ 17.         x = !C && B

________ 18.         x = ( E < 10) && (E == F)

________ 19.         x = A && B || C && D

________ 20.         x = !(A && B) || !(D && C)

Write c++ statements for each of the following (no declarations necessary here):

  1. Output a message that says "Hello everybody"  

                                                                                   

  1. Prompt the user to enter a name.                      
  1. Input a name into a variable.    
                             
  2. Output Hello and the name you input.  
  3. Prompt for two numbers.                                 
  1. Input two numbers.           

                                   
  2. Compute the sum of the two numbers.  
  3. Output "the sum is" followed by the sum.   
           
  4. Modify the previous statement to echo print the two numbers entered. " the sum of x and y is z"; Do not use x, y, z use variables from above.

  1. Input the price of an item.             
                        
  2. Calculate the sales tax.                         
  1. Compute the total price, given price and sales tax.
  1. Compute the average of three test scores.     
      

In: Computer Science

Using c++, complete the functions to fulfill requirements. Basically, turn test case into unit test code....

Using c++, complete the functions to fulfill requirements. Basically, turn test case into unit test code.

You may only use:

- iostream, cmath

/*
BLAS Level 1 function declarations
*/

#ifndef BLAS_H
#define BLAS_H

/*
Find the element with the maximum absolute value.
Input:
   x : vector (as array of doubles)
   len : number of elements in x (dimension)
Output: index of the first element with maximum absolute value
Errors: returns -1 if vector is empty (len = 0)
*/
int amax(
const double* x,
const unsigned int len);

/*
Sum the absolute values.
Input:
   x : vector (as array of doubles)
   len : number of elements in x (dimension)
Output: sum of the absolute values of the elements.
Returns 0 if x is empty.
*/
double asum(
const double* x,
const unsigned int len);

/*
Generalized vector addition (afine transformation)
Input:
   a : scalar value
   x : vector (as an array of doubles)
   y : vector (as an array of doubles)
   len : number of elements in x and y (dimension, assumed equal)
Output: None. y is updated as y = a*x + y
*/
void axpy(
const double a,
const double* x,
double* y,
const unsigned int len);

/*
Copy a vector.
Input:
   x : source vector (as an array of doubles)
   y : destination vector (as array of doubles)
   len : number of elements in x and y (dimension, assumed equal)
Output: None. y is updated as y = x
*/
void copy(
const double* x,
double* y,
const unsigned int len);

/*
Dot (inner) product of two vectors.
Input:
   x : vector (as an array of doubles)
   y : vector (as an array of doubles)
   len : number of elements of x and y (dimension, assumed to be equal)
Output: dot (inner) product of x and y: x . y
Return 0 if x and y are empty.
*/
double dot(
const double* x,
const double* y,
const unsigned int len);

/*
Euclidean norm of a vector.
Input:
   x : vector (as an array of doubles)
   len : number of elements of x (dimension)
Output: magnitude (length) of x as the distance from the origin to x (as a point)
Returns 0 if x is empty.
*/
double norm2(
const double* x,
const unsigned int len);

/*
Scale a vector.
Input:
   a : scalar value
   x : vector (as an array of doubles)
   len : number of elements in x (dimension)
Output: None. x is scaled by a: x = a*x;
*/
void scale(
const double a,
double* x,
const unsigned int len);

/*
Swap two vectors.
Input:
   x : vector (as an array of doubles)
   y : vector (as an array of doubles)
   len : number of elements in x and y (dimension, assumed to be equal)
Output: None. x and y are updated as x,y = y,x
*/
void swap(
double* x,
double* y,
const unsigned int len);

#endif

In: Computer Science

In c++ format please Bank Charges A bank charges $10 per month plus the following check...

In c++ format please

Bank Charges
A bank charges $10 per month plus the following check fees for a commercial checking account:

  • $.10 each for fewer than 20 checks

  • $.08 each for 20–39 checks

  • $.06 each for 40–59 checks

  • $.04 each for 60 or more checks


The bank also charges an extra $15 if the balance of the account falls below $400 (before any check fees are applied).

Write a program that asks for the beginning balance and the number of checks written. Compute and display the bank’s service fees for the month.


Input Validation: Do not accept a negative value for the number of checks written. If a negative value is given for the beginning balance, display an urgent message indicating the account is overdrawn.

In: Computer Science

Please note: This is in Visual Basic. Create an application. Add a text box, a label,...

Please note: This is in Visual Basic.

Create an application. Add a text box, a label, and a button to the form. If the user enters a number that is greater than 100 in the text box, the button's "click" event procedure should display the result of multiplying the number by 5. Otherwise, it should display the result of dividing the number by 5. Code the procedure.

In: Computer Science

Create a Java program which prints a truth table for any 2 variables propositional function. Assuming...

Create a Java program which prints a truth table for any 2 variables propositional function.
Assuming variables p and q. Instead of the symbols for "and" and "or", just used the words. For "not", use the tilde "~"

Prompt the user for 3 questions
1: "p and q"? Or "p or q"?
2: Do you want to negate p?
3: Do you want to negate q?

For example, suppose in a menu system the user chose "p or q", and to negate q. The output should look similar to this:

p | q | (p or ~q)
------------------
T | T | T
T | F | T
F | T | F
F | F | T

In: Computer Science

The Board of Directors of Northwind have appointed Doug Hanus at their new CEO and Jeff...

The Board of Directors of Northwind have appointed Doug Hanus at their new CEO and Jeff Hogan as their operational manager. They are planning to devote their first two weeks in office to gain a better understanding of Northwind’s supply chain and marketing processes. As senior database analyst for Northwind, it is your responsibility to code appropriately structured SQL statements for retrieving the following information requested by Doug and Jeff. They need it on or before 09/29/2019.

  1. A listing of Northwind’s suppliers. [1 pt.]

  1. A listing of Northwind’s suppliers based in Norway and Sweden. [2 pts]

  1. A listing of Northwind’s product categories and the description of each product category. [2 pts]

  1. A clearer picture of the geographical footprint of their customers and suppliers - they want separate listings of the countries in which their customers and suppliers are located. [2 pts]

  1. The average, sum, maximum, and minimum per unit cost across all products in their product line. They would also like to know the names of Northwind’s products having per unit cost between 30 and 50 (both inclusive). [2 pts]
  1. A count and a listing of the cities and corresponding countries in North America (USA, Canada, Mexico) where they have a customer base. [3 pts]

  1. A listing of the product names and its corresponding category for products from suppliers based in Germany and France. [4 pts]

  1. A list of countries outside of North America (i.e. USA, Canada, Mexico) where they have less than 3 suppliers. [4 pts]

  1. For OrderIDs 10258, 10259, and 10260, a listing of the corresponding customer, employee who accepted the order, and the shipper. The listed must be sorted alphabetically by customer name. [5 pts]

  1. A listing of the product names and supplier names for all products that make up OrderIDs 10254 and 10260. [5 pts]

In: Computer Science

2. Determine whether the following Propositional Logic statements are valid or invalid arguments. You may use...

2. Determine whether the following Propositional Logic statements are valid or invalid arguments. You may use a truth table, proofs using rules of inference, or resolution (specify which method you are using).

(a) p→q, ~q→r, r; ∴p

(b) ~p∨q, p→(r∧s), s→q; ∴q∨r

(c) p→(q→r), q; ∴p→r

In: Computer Science

Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use...

Please, i need Unique answer, Use your own words (don't copy and paste).

*Please, don't use handwriting.

DDoS attack

Based on the Internet, access to the article intituled: ‘A survey on DDoS attack and defense strategies from traditional schemas to current techniques’.

1- Describe the DDoS attack.

2- Provide at least two exploited vulnerabilities used by hacker to perform the DDoS attack.

3- Provide at least two countermeasures against DDoS.

In: Computer Science

We are given an array of n numbers A in an arbitrary order. Design an algorithm...

  1. We are given an array of n numbers A in an arbitrary order. Design an algorithm to find the largest and second largest number in A using at most 3/2n -2 comparisons.

(i) describe the idea behind your algorithm in English (3 points);

(ii) provide pseudocode (5 points);

(iii) analyze the number of comparisons used in your algorithm (2 points).

In: Computer Science

Part 1: In each of the following scenarios, tell whether there is a violation of confidentiality,...

Part 1: In each of the following scenarios, tell whether there is a violation of confidentiality, integrity, or availability, or some combination of the three. In addition, for each item, write a two- or three-sentence paragraph explaining why your answer is correct.

Alex disables Barbara's router by logging in remotely with the manufacturer's default password.

Mallory builds a WiFi jammer using plans she found on the Internet and jams wireless signals over a large part of her apartment building.

Charlene uses a key logger to capture Darla's banking password.

Eve rewrites the magetic stripe on a gift card to change the amount from $10 to $100.

(Adapted from an exercise in Bishop, Matt, Introduction to Computer Security.)

Part 2: Distinguish among vulnerability, exploit, threat, risk, and control mechanism (called "countermeasure" in chapter one of the text) in five brief paragraphs. If you do any research outside the textbook, which you are encouraged to do, be sure to cite your sources. You can see how to do that in An Example of Proper Writing in the "Required Reading" section.

Part 3: Using the tool at http://www.fileformat.info/tool/hash.htm, compute the SHA-256 checksum of the MS-Word file that is your work on this assignment so far, or some similar file if you don't have that one available. Copy the calculated cryptographic hash into Windows Notepad or word processing document to save it temporarily. Now change one character from a capital to a lowercase letter or vice-versa in the original document, re-save, and recompute the the cryptographic hash. Paste the old and new cryptographic hashes into your homework document. Be sure to identify which one is before and which is after.

Using the information from the textbook, explain at least two uses for a cryptographic hash, and explain how the experiment you just performed confirms those uses.

Do some research and explain in a paragraph or so what a "hash collision" is. Be sure to cite your research.

Part 4: Explain in a couple of paragraphs how public key encryption can be used to implement a digital signature. Be sure you are very clear on when a private key is used and when a public key is used.

Part 5: Generally, a digital signature involves encrypting a cryptographic hash, or digest, generated from the message. Explain why we do we not encrypt the message itself. You can answer this question in one sentence.

Part 6: For each of the following scenarios below, tell what type of encryption is most appropriate and in a sentence or two explain the reasoning for your choice.

Alice wants to send a confidential message to Bill, whom she has never met and who lives in a distant country.

Charlie wants to be sure that no one but he can see the financial and medical records he has stored on his computer.

David needs a way to check that large computer files stored on corporate servers have not been modified.

Eddard uses a "cloud" backup service; he wants to be sure the operators of the service cannot read his files.

Frank needs to send a message to George. The message need not be confidential, but George must be assured that it actually came from Frank.

In: Computer Science

how does rootkit work?

how does rootkit work?

In: Computer Science

###### THIS SHOULD BE IN PYTHON Calculate the sum of cubes. If the input is x,...

###### THIS SHOULD BE IN PYTHON

Calculate the sum of cubes. If the input is x, the sum of cubes is equal to: 13 + 23 + ... + x3


Take input for the number of cubes to sum.
No error checking is needed.
Specifically, you may assume that the input is always a positive integer

Here are some sample runs:
Enter how many cubes to sum: 1   
1   

Enter how many cubes to sum: 3
36

Enter how many cubes to sum: 4
100

Enter how many cubes to sum: 2
9

In: Computer Science

What is the benefit of a harvard architecture for a cache?

What is the benefit of a harvard architecture for a cache?

In: Computer Science