------------------------------------------------------------------------- The classic drunkard's walk problem: Over an eight block line, the home of an intoxicated...

-------------------------------------------------------------------------

The classic drunkard's walk problem: Over an eight block line,
the home of an intoxicated chap is at block 8, and a pub is at block 1.
Our poor friend starts at block n, 2 <= n <= 7, and wanders at random,
one block at a time, either toward or away from home. At any intersection,
he moves toward the pub with a certain probability, say 2/3, and towards
home with a certain probability, say 1/3. Having gotten either home or to
the pub, he remains there. Write a program to simulate 1000000 trips in which
he starts at block 2, another 1000000 in which he starts at block 3, and so
forth up through block 7. For each starting point, calculate and print the
proportion of the time he ends up at home and the average number of blocks
he walked on each trip.

For the random number generation...

Use the 'srand' function to seed the random number generator.
Use the 'rand' function (and mod as needed) to get random probabilities
for a given step.


************************************************************************
* *
* To do each single walk, call a function that runs through a loop *
* until the walk is done. *
* *
************************************************************************



-------------------------------------------------------------------------


A sample run might look something like...

lab6

I = 2
TotalMoves = 2834110
Avg moves = 2.834110
total Home = 7820
avg home = 0.0078200


I = 3
TotalMoves = 5503639
Avg moves = 5.503639
total Home = 23621
avg home = 0.0236210


I = 4
TotalMoves = 7830959
Avg moves = 7.830959
total Home = 54851
avg home = 0.0548510


I = 5
TotalMoves = 9519658
Avg moves = 9.519658
total Home = 118166
avg home = 0.1181660


I = 6
TotalMoves = 9875095
Avg moves = 9.875095
total Home = 243413
avg home = 0.2434130


I = 7
TotalMoves = 7581532
Avg moves = 7.581532
total Home = 496420
avg home = 0.4964200




-------------------------------------------------------------------------
Please write the program in computer and test it, and copy the program and poste it in the answer
Thank you

In: Computer Science

In water being drawn up the capillary tube, which of the following is acting directly on...

In water being drawn up the capillary tube, which of the following is acting directly on the water molecules in the center of the tube?

Group of answer choices

cohesion

adhesion

adhesion and cohesion

desity

In: Biology

Chuck Brown will receive from his investment cash flows of $3,155, $3,500, and $3,820 at the...

Chuck Brown will receive from his investment cash flows of $3,155, $3,500, and $3,820 at the end of years 1, 2 and 3 respectively. If he can earn 7.5 percent on any investment that he makes, what is the future value of his investment cash flows at the end of three years? (Round to the nearest dollar.)

In: Finance

What is the purpose of calculating WACC, meaning how can it be used to calculate the...

What is the purpose of calculating WACC, meaning how can it be used to calculate the current value of the firm and to assess if the firm creating value?

In: Finance

Need in C# with the exact style of output listed. Assignment7A: A new field of computer...

Need in C# with the exact style of output listed.

Assignment7A: A new field of computer science: Small Data. Big Data is a really hot area in computing right now and there are tons of jobs in it. Here in FYE, we care more about the field of Small Data, because if you can work with small data, you can extend that to working with big data. For this assignment, you’re going to implement the most common operations on arrays. Specifically, initializing them, printing them, finding the min, finding the max, and finding the sum. These are used all the time, so our recommendation is to understand how to solve the underlying problem and use that as a model for solving harder problems. Write a program that creates an array of 100 integers. I would recommend “pre-initializing” each cell to either 0 or -1 before doing anything else because it will make things easier later. After that, you should write separate (static) functions for initializing the array (from user input - according to the behavior below), printing the array (according to the behavior below – only values that have been entered by the user), finding the minimum element of the array, finding the maximum element of the array, and finding the sum of all elements of the array. Assume that the values the user enters are between 0 – 99. Hint: a very convenient thing would be if your initialization function returned the number of elements the user typed in.

Sample Output #1:

Enter a number or -1 to finish: 6

Enter a number or -1 to finish: 9

Enter a number or -1 to finish: 3

Enter a number or -1 to finish: 1

Enter a number or -1 to finish: 9

Enter a number or -1 to finish: 76

Enter a number or -1 to finish: 42

Enter a number or -1 to finish: 1

Enter a number or -1 to finish: -1

|6|9|3|1|9|76|42|1|

Min is: 1

Max is: 76

Sum is: 147

In: Computer Science

Compare and contrast rates of glycogen metabolism in liver and muscle cells based on hormone stimulation...

Compare and contrast rates of glycogen metabolism in liver and muscle cells based on hormone stimulation and energy charge of the cell.

Part 1 complete the table by replacing question mark (?) with “high” or “low” as required.

Cell

Blood [insulin] (high/low)

Blood [glucagon] (high/low)

Glycolysis rate1 (high/low)

Glycogen breakdown rate (high/low)

Glycogen synthesis rate (high/low)

Glucose release rate2 (high/low)

Liver

High

Low

Low

?

?

?

Liver

High

Low

High

?

?

?

Liver

Low

High

Low

?

?

?

Liver

Low

High

High

?

?

?

Muscle

High

Low

Low

?

?

?

Muscle

High

Low

High

?

?

?

Muscle

Low

High

Low

?

?

?

Muscle

Low

High

High

?

?

?

Muscle

High

Low

Low

?

?

?

1Rate is high or low based on energy charge of the cell and not owing to [glucose] in cell

2Release means transport from the cell to the blood. Low rate could mean no detectable rate

Part 2. (Each row in the table is a separate condition. Interpret each condition independently)

Explain how the conditions regulate specific enzymes to stimulate or inhibit the rates of glycogen breakdown and glycogen synthesis.

Explain glucose release

In: Biology

5. What are the specific types of channels found along the membrane of the dendrites and...

5. What are the specific types of channels found along the membrane of the dendrites and cell body? For

       each channel stated, identify what ions will cross the channel and in what direction? Indicate if the ions        

       would cause an excitatory post-synaptic potential or an inhibitory post-synaptic potential.

        Dendrites/cell body

Channels

Ions

What direction?

The intracellular fluid

becomes more

positive or negative

Cause excitatory post-synaptic potential or inhibitory post-synaptic potential

In: Biology

The toco toucan, the largest member of the toucan family, possesses the largest beak relative to...

The toco toucan, the largest member of the toucan family, possesses the largest beak relative to body size of all birds. This exaggerated feature has received various interpretations, such as being a refined adaptation for feeding. However, the large surface area may also be an important mechanism for radiating heat (and hence cooling the bird) as outdoor temperature increases. Here are data for beak heat loss, as a percent of total body heat loss from all sources, at various temperatures in degrees Celsius. [Note: The numerical values in this problem have been modified for testing purposes.]

Temperature (oC)(oC) 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Percent heat loss from beak 34 35 33 33 35 48 54 52 45 50 44 54 59 62 64 64

The equation of the least-squares regression line for predicting beak heat loss, as a percent of total body heat loss from all sources, from temperature is: (Use decimal notation. Enter the values of the intercept and slope rounded to two decimal places. Use the letter ?x to represent the value of the temperature.)

?̂ =_____

Use the equation of the least‑squares regression line to predict beak heat loss, as a percent of total body heat loss from all sources, at a temperature of 2525 degrees Celsius. Enter your answer rounded to two decimal places.

beak heat as a percent of total body heat loss=beak heat as a percent of total body heat loss=_____%

What percent of the variation in beak heat loss is explained by the straight-line relationship with temperature? Enter your answer rounded to two decimal places.

percent of variation in beak heat loss explained by the equation=percent of variation in beak heat loss explained by the equation=_____%

Find the correlation ?r between beak heat loss and temperature. Enter your answer rounded to three decimal places.

?=_____

In: Math

• What does it mean for two variables, such as current and potential, to have a...

• What does it mean for two variables, such as current and potential, to have a linear relationship to each other? Describe two devices— incandescent lamps and diodes— in which current and potential do not follow Ohm’s Law. Why are these two devices exceptions? Use Kirchhoff’s loop rule for potentials and junction rule for currents to describe how a single battery in a car can be used to power multiple electrical devices.

In: Physics

Write a program that accepts an integer as input and then displays all the prime numbers...

Write a program that accepts an integer as input and then displays all the prime numbers smaller than or equal to that number.

In: Computer Science

Write a program which takes three lists of names, and print out all the names only...

Write a program which takes three lists of names, and print out all the names only once. The expected runtime should be O(n) where n is the total number of names in the lists. You don’t have to sort the list. Use appropriate data structure to store the names, so add all data to the collection only once efficiently. The read-in list method and list1, list2, list3 is given. You may assume that the expected runtime of searching or inserting into a hash table is O(1). Do not call the list's contains method, because it slows down the run time.

import java.io.*;
import java.util.*;
public class A4PrintName{
   public static List<String> readInFile(String filename){
      List<String> input = new ArrayList<>();
      try (Scanner sin = new Scanner(new FileReader(filename))){
         while (sin.hasNextLine()){
            input.add(sin.nextLine());
         }
      } catch (FileNotFoundException e){
         e.printStackTrace();
      }
      return input;
  }
   public static void main(String[] args){
      List<String> namelist1 = readInFile("A4input1.txt");
      List<String> namelist2 = readInFile("A4input2.txt");
      List<String> namelist3 = readInFile("A4input3.txt");
      Set<String> names;
      //your code starts here... you may write any function where you need.
   }
}

list 1:

Amy
Andy
Anna
Ben
Benjamin
Catherine
Emma
James
Jessie
Jennifer
John
Karen
Kelly
Kyle
Lena
Liam
Mary
Mia
Steve
William

list 2:

Amy
Andy
Anne
Ben
Benjamin
Catherine
David
Emma
James
Jessie
Jennifer
Jenny
John
Karen
Kelly
Kyle
Mary
Mia
Selina
Tina
William

list 3:

Amy
Ana
Anne
Dave
George
Selina
Shawn
William

In: Computer Science

Simple, short explanations, please. A)Why might it be important to add a separator bar to a...

Simple, short explanations, please.

A)Why might it be important to add a separator bar to a submenu item in the menu form? When a program has a lot of items for the user to select from, why should you avoid displaying all of the items on one menu?

B) Discuss the importance of GUI guidelines for menus. give an example of messy menus vs. well-organized menus, and how that affects the user experience.

C) Describe the three steps that must be taken when a data file is used by a program, why should a program close a file when it's finished using it?

D) Today, most information kept by companies is stored in databases. When might it be appropriate to use text files? (small amount of data, data needs randomly accessed?)

In: Computer Science

I got a problem in C struct. I made a aa.txt file and read data by...

I got a problem in C struct. I made a aa.txt file and read data by struct. I am learning how to pass variable and value between function by pointers.

The first line in txt (integer 5) means I need to read the next five lines data to struct

aa.txt

5

111

222

333

444

555

*********************************************************************

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int i,totalRow;
char inBuf[20];
char str[20];
void readData();
void sum() ;

typedef struct demo{

int num;
}demo1;
  

int main()
{
  
struct demo demo1;
struct demo *sptr;
sptr= &demo1;
sum(sptr);
return 0;
}
  

void readData(struct demo *ptr)
{
  
int i,j;
FILE *fin = NULL;
fin = fopen("aa.txt", "r");   
if (fin == NULL)
{
    printf("Could not open the file.\n");
   }
fgets(str, sizeof(str), fin);
       sscanf(str,"%d ",&totalRow);   
printf("%d\n",totalRow);
   for(i = 0; i {
fgets(str,sizeof(str),fin);
sscanf(str,"%d ", &ptr->num);
       printf("%d\n", ptr->num);   
}
fclose(fin);   
return;
}

//find the sum   
void sum(struct demo *ptr)
{
int result;
readData(ptr);
printf("the sum is %d\n", ptr->num);
return;  
}

*******************************************************************************

My code of sum function is wrong, I have no idea how to pass the data to sum function from readData function.

readData function can read the data from the file, it works.

Maybe the problem is still in the readData function, because I guess I did not store the data to memory(I am not sure)

Thanks

In: Computer Science

In the RSA cryptosystem, it is possible that M = C, that is, the plaintext and...

In the RSA cryptosystem, it is possible that M = C, that is, the plaintext and the ciphertext may be identical.

Is this a security concern in practice?

For modulus N = 3127 and encryption exponent e = 17, find at least one non trivial message M (i.e. M > 1) that encrypts to itself

In: Computer Science

For each of the unrelated transactions described below, present the entries required to record each transaction....

For each of the unrelated transactions described below, present the entries required to record each transaction.

1. Sweet Corp. issued $19,100,000 par value 9% convertible bonds at 97. If the bonds had not been convertible, the company’s investment banker estimates they would have been sold at 95.
2. Pharoah Company issued $19,100,000 par value 9% bonds at 96. One detachable stock purchase warrant was issued with each $100 par value bond. At the time of issuance, the warrants were selling for $4.
3.

Suppose Sepracor, Inc. called its convertible debt in 2017. Assume the following related to the transaction. The 10%, $10,900,000 par value bonds were converted into 1,090,000 shares of $1 par value common stock on July 1, 2017. On July 1, there was $57,000 of unamortized discount applicable to the bonds, and the company paid an additional $81,000 to the bondholders to induce conversion of all the bonds. The company records the conversion using the book value method.

No Account Titles Debit Credit
1.
2.
3.

In: Accounting