Questions
USE R TO WRITE THE CODES! # 2. More Coin Tosses Experiment: A coin toss has...

USE R TO WRITE THE CODES!

# 2. More Coin Tosses
Experiment: A coin toss has outcomes {H, T}, with P(H) = .6.
We do independent tosses of the coin until we get a head.

Recall that we computed the sample space for this experiment in class, it has infinite number of outcomes.

Define a random variable "tosses_till_heads" that counts the number of tosses until we get a heads.
```{r}

```

Use the replicate function, to run 100000 simulations of this random variable.
```{r}

```
Use these simulations to estimate the probability of getting a head after 15 tosses. Compare this with the theoretical value computed in the lectures.
```{r}

```
Compute the probability of getting a head after 50 tosses. What do you notice?
```{r}

In: Computer Science

Write a C ++ program that asks the user for the speed of a vehicle (in...

Write a C ++ program that asks the user for the speed of a vehicle (in miles per hour) and how many hours it has traveled. The program should then use a loop to display the distance the vehicle has traveled for each hour of that time period. Here is an example of the output:

What is the speed of the vehicle in mph? 40
How many hours has it traveled? 3
Hour Distance Traveled
--------------------------------
1           40
2           80
3          120

Input Validation: Do not accept a negative number for speed and do not accept any value less than 1 for time traveled.

Distance Traveled

The distance a vehicle travels can be calculated as follows:

   distance = speed * time

For example, if a train travels 40 miles per hour for 3 hours, the distance traveled is 120 miles.

In: Computer Science

1. The functional dependencies for the ProAudio relation: c_id -> f_name, l_name, address, city, state, zip...

1. The functional dependencies for the ProAudio relation:

c_id -> f_name, l_name, address, city, state, zip

item_id -> title, price

ord_no -> c_id, order_date

ord_no  + item_id  -> shipped

zip -> city, state

Original ProAudio relation:

c_id f_name I_name address city state zip ord_no item_id title price order_date shipped
01 Jane Doe 123 Elm St Ely NV 11111 1-1 12-31 More Blues 8.99 12-2-00 no
02 Fred Fish 321 Oak St Ely NV 11111 2-1 21-12 Jazz Songs 9.99 11-9-00 yes
01 Jane Doe 123 Elm St Ely NV 11111 1-2 12-21 The Blues 8.99 12-2-00 yes

determining functional dependencies for ProAudio database

Normalization is a set of rules that ensures the proper design of a database. In theory, the higher the normal form, the stronger the design of the database.

Use the file for Functional Dependencies Above to answer the following questions:

Now that you are familiar with the mission statement and the entities and attributes the for ProAudio:

  1. What are types of anomalies can occur when normalization has not taken place?
  2. Define Anomalies- definitions in your own words
    • Anomalie 1
    • Anomalie 2
    • Anomalie 3

In: Computer Science

After reading the Biography in Context database entries on Bill Gates and Steve Jobs, briefly compare...

After reading the Biography in Context database entries on Bill Gates and Steve Jobs, briefly compare and contrast these two leaders of industry. Considering that while both are quite different, observe some unifying qualities.

In: Computer Science

How would you write the following recursively? This is in Java.    public static String allTrim(String...

How would you write the following recursively? This is in Java.


  

public static String allTrim(String str) {
int j = 0;
int count = 0; // Number of extra spaces
int lspaces = 0;// Number of left spaces
char ch[] = str.toCharArray();
int len = str.length();
StringBuffer bchar = new StringBuffer();
if (ch[0] == ' ') {
while (ch[j] == ' ') {
lspaces++;
j++;
}
}

for (int i = lspaces; i < len; i++) {
if (ch[i] != ' ') {
if (count > 1 || count == 1) {
bchar.append(' ');
count = 0;
}
bchar.append(ch[i]);
} else if (ch[i] == ' ') {
count++;
}
}
return bchar.toString();
}

In: Computer Science

Any ideas? You work in the IT group of a department store and the latest analytics...

Any ideas?

You work in the IT group of a department store and the latest analytics shows there is a bug that
allows customers to go over their credit limit. The company's president has asked you to develop a
new algorithm to solve this problem.
Create your algorithm using pseudocode that determines if a department store customer has
exceeded their credit limit. Be sure you gather the following inputs from the user:
• Account number
• Balance of the account
• Total cost of all the products the customer is looking to purchase
• Allowed credit limit
After you gather the inputs, make sure your algorithm calculates if the user can purchase the
products and provides a message to the user indicating if the purchase is approved or declined.

In: Computer Science

Write a single, complete If-else-if segment of code based on a variable called ‘Average’ which will...

Write a single, complete If-else-if segment of code based on a variable called ‘Average’ which will process the following task:

  1. Display "You made the Dean's List if Average > 95.

Variable=average;

If (average >=95);

{

messagebox.show(“you made the deans list”);

}
             (B) Display "You made the Optimate Society” if Average >= 90

Else if (average>=90);

}

Messagebox.show(“you made the Optimate Society”);

}
             (C) Otherwise Display "You need a 90 to make an honors list"

Else if (average <=89);

{

Messagebox.show(“you need a 90 to make an honors list”);

In: Computer Science

Write a program that prompts for the lengths of the sides of a triangle and reports...

Write a program that prompts for the lengths of the sides of a triangle and reports the three angles. Make sure you have a good introduction stating what the program does when it is run, and a helpful prompt for the user when asking for input:

i.e. Here is the generated output from a sample program:

This program computes the angles of a triangle given the lengths of the sides.

What is the length of side 1? <wait for user input>

What is the length of side 2? <wait for user input>

What is the length of side 3? <wait for user input>

angle 1 = <angle in degrees for side 1, side 2, and side 3>

angle 2 = <angle in degrees for side 2, side 3, and side 1>

angle 3 = <angle in degrees for side 3, side 1, and side 2>

Requirements

  • Your program must have at least 1 function with parameters, that when called with arguements returns a value.

Hints

  • Make sure to store your input in a variable.
  • Convert your input from a string to a float.
  • You will need to import the math library
  • You can use a variant of the law of cosines to compute the angles:
    • angle = arccos( (a^2 + b^2 - c^2) / (2ab) )
  • The math.acos() and math.degrees() methods will be useful.
  • Write a function for computing the angle that takes three parameters, a, b, and c
  • You only need one function for computing all three angles.

Save your program as triangle_angles.py and attach it.

In: Computer Science

Which of the following statement will, move the file pointer to the third ‘r’ in the...

Which of the following statement will, move the file pointer to the third ‘r’ in the file show below. Assume the newline character is 1 byte. Select all that apply.

                With

                great

                power

                comes

                great

                responsibility

Answers:

                Spidey.seekg(-19L, ios:end);

                Spidey.seekg(‘r’, ios:beg);

                Spidey.seekg(24, ios:cur);

                Spidey.seekg(“r?r?r”, ios:beg);

In: Computer Science

Describe PowerShell and give examples of the syntax.

Describe PowerShell and give examples of the syntax.

In: Computer Science

You are expected to design a circuit with (3bit)counter and skip next signal with other necessary...

You are expected to design a circuit with (3bit)counter and skip next signal with other necessary control signals to complete your labwork.
You have to include your gdf file and simulation file(scf).  
Zip/Rar your project files.

In: Computer Science

Web Programming Task + Database sql Write a command to display the ISBN number and the...

Web Programming Task + Database sql

  • Write a command to display the ISBN number and the price in the table books.
    • Question #2: What command did you enter?
    • Answer:
  • Write a command to increase the price of each book in the table books by 50 cents.
    • Question #3: What command did you enter?
    • Answer:
  • Write a command to display the price and title in the table books of ISBN 0-672-31697-8
    • Question #4: What command did you enter?
    • Answer:
  • Write a command to change the price in the table books of ISBN 0-672-31697-8 to 25.00.
    • Question #5: What command did you enter?
    • Answer:
  • Write a command to insert yourself into the table customers. Remember customerid is autoincrement.
    • Question #6: What command did you enter?
    • Answer:
  • Write a command to delete yourself from the table customers.
    • Questin #7: What cmmand did you enter?
    • Answer:

In: Computer Science

ASSEMBLY LANGUAGE PROGRAMMING 1. The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B...

ASSEMBLY LANGUAGE PROGRAMMING

1. The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B is ______________.

2. The decimal equivalent of the unsigned 8-bit hex number 0B4H is ______________.

3. The value of the expression ‘H’ – ‘B’ is less than / equal to / greater than that of the expression ‘L’ – ‘C’.

4. If the .data segment contains declarations A BYTE 2 DUP (‘a’), ‘+’ B BYTE 3 DUP (‘b’), 0 C BYTE 4 DUP (‘c’), ‘–’ D BYTE 5 DUP (‘d’), 0 then the instruction input A, D, 6 will display a Windows dialog box with title _______________________________.

5. If eax = 302B59A1H, and ebx = 700CD37DH, then the instruction add ax, bx will leave the value ______________________________ in the eax register.

6. If eax = 0FFFFFFFFH, and edx = 0FFFFFFFFH, then the instruction imul edx will leave the value ______________________________ in the edx register.

7. If eax = 0D000000DH, and edx = 50000005H, then the instruction idiv dl will leave the value ______________________________ in the eax register.

8. If ax = 3BC4H, then the following instructions cmp ah, al jg Label will / will not cause a jump to Label.

9. If ax = 3BC4H, then the following instructions cmp ah, al ja Label will / will not cause a jump to Label.

10. The following instructions mov eax, 0 mov ecx, 1100B L1: inc eax loop L1 will leave the value ______________________________ in the eax register.

In: Computer Science

1. The functional dependencies for the ProAudio relation: c_id -> f_name, l_name, address, city, state, zip...

1. The functional dependencies for the ProAudio relation:

c_id -> f_name, l_name, address, city, state, zip

item_id -> title, price

ord_no -> c_id, order_date

ord_no  + item_id  -> shipped

zip -> city, state

Original ProAudio relation:

c_id f_name I_name address city state zip ord_no item_id title price order_date shipped
01 Jane Doe 123 Elm St Ely NV 11111 1-1 12-31 More Blues 8.99 12-2-00 no
02 Fred Fish 321 Oak St Ely NV 11111 2-1 21-12 Jazz Songs 9.99 11-9-00 yes
01 Jane Doe 123 Elm St Ely NV 11111 1-2 12-21 The Blues 8.99 12-2-00 yes

determining functional dependencies for ProAudio database

Normalization is a set of rules that ensures the proper design of a database. In theory, the higher the normal form, the stronger the design of the database.

Use the file for Functional Dependencies Above to answer the following questions:

Now that you are familiar with the mission statement and the entities and attributes the for ProAudio:

  1. Identify anomalies in ProAudio- Give 3 examples means that you list specific instances from ProAudio on insert, delete or update anomalies, describing each in the context of the ProAudio database.
    • ProAudio Anomaly example 1
    • ProAudio Anomaly example 2
    • ProAudio Anomaly example 3
  1. Resolve ProAudio anomalies- citing the anomalies you described in the previous section- specifically say how to fix each one
    • Fix 1
    • Fix 2
    • Fix 3

In: Computer Science

Using the Web or other resources, research an example of Cyber Terrorism. Write a brief Discussion...

Using the Web or other resources, research an example of Cyber Terrorism.

Write a brief Discussion describing the terrorism attack and it's aftermath. Comment on ways the attack could have been prevented.

Post between 300 and 400 words.

In: Computer Science