3. Assume that a particle is confined to a box of length L, and that the system wave function is
ψ(x)=sqrt(2/L)*sin[(π*x)/(L)]
(1) Is this state an eigenfunction of the momentum operator? Show
your work.
(2) Calculate the average value of the momentum <p> that
would be obtained for a large number of measurements. Explain your
result.
(3) Calculate the probability that the particle is found between
0.31 L and 0.35 L.
In: Chemistry
In a multiple choice exam, there are 7 questions and 4 choices for each question (a, b, c, d). Nancy has not studied for the exam at all and decides to randomly guess the answers. What is the probability that: (please round all answers to four decimal places)
a) the first question she gets right is question number 3?
b) she gets all of the questions right?
c) she gets at least one question right?
In: Math
A consensus forecast is the average of a large number of individual analysts' forecasts. Suppose the individual forecasts for a particular interest rate are normally distributed with a mean of 6 percent and a standard deviation of 1.6 percent. A single analyst is randomly selected. Find the probability that his/her forecast is
Round your answers to 4 decimal places.
(a) At least 3.4 percent.
(b) At most 8 percent.
(c) Between 3.4 percent and 8
percent.
In: Math
Say 5% of circuit boards tested by a manufacturer are defective. Let Y be the number of defective boards in a random sample of size n = 25.
What kind of random variable is Y ? In particular, write Y ~Distribution(p, n), where you fill in the correct distribution name and parameters p and n.
Determine P (Y ≥ 5).
DetermineP(1≤Y ≤4).
What is the probability that none of the 25 boards are defective?
In: Math
In: Statistics and Probability
**C programming language
The following description has been adopted from Deitel & Deitel. One of the most popular games of chance is a dice game called "craps," which is played in casinos and back alleys throughout the world. The rules of the game are straightforward:
A player rolls two dice. Each die has six faces. These faces contain 1, 2, 3, 4, 5, and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. If the sum is 7 or 11 on the first throw, the player wins. If the sum is 2, 3, or 12 on the first throw (called "craps"), the player loses (i.e. the "house" wins). If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then the sum becomes the player's "point." To win, you must continue rolling the dice until you "make your point." The player loses by rolling a 7 before making the point.
Write a program that implements a craps game according to the above rules. The game should allow for wagering. This means that you need to prompt that user for an initial bank balance from which wagers will be added or subtracted. Before each roll prompt the user for a wager. Once a game is lost or won, the bank balance should be adjusted. As the game progresses, print various messages to create some "chatter" such as, "Sorry, you busted!", or "Oh, you're going for broke, huh?", or "Aw cmon, take a chance!", or "You're up big, now's the time to cash in your chips!"
Use the below functions to help you get started! You may define more than the ones suggested if you wish!
|
(5 pts) void print_game_rules (void) — Prints out the rules of the game of "craps". |
|
|
(5 pts) double get_bank_balance (void) - Prompts the player for an initial bank balance from which wagering will be added or subtracted. The player entered bank balance (in dollars, i.e. $100.00) is returned. |
|
|
(5 pts) double get_wager_amount (void) - Prompts the player for a wager on a particular roll. The wager is returned. |
|
|
(5 pts) int check_wager_amount (double wager, double balance) - Checks to see if the wager is within the limits of the player's available balance. If the wager exceeds the player's allowable balance, then 0 is returned; otherwise 1 is returned. |
|
|
(5 pts) int roll_die (void) - Rolls one die. This function should randomly generate a value between 1 and 6, inclusively. Returns the value of the die. |
|
|
(5 pts) int calculate_sum_dice (int die1_value, int die2_value) - Sums together the values of the two dice and returns the result. Note: this result may become the player's point in future rolls. |
|
|
(10 pts) int is_win_loss_or_point (int sum_dice) - Determines the result of the first dice roll. If the sum is 7 or 11 on the roll, the player wins and 1 is returned. If the sum is 2, 3, or 12 on the first throw (called "craps"), the player loses (i.e. the "house" wins) and 0 is returned. If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then the sum becomes the player's "point" and -1 is returned. |
|
|
(10 pts) int is_point_loss_or_neither (int sum_dice, int point_value) - Determines the result of any successive roll after the first roll. If the sum of the roll is the point_value, then 1 is returned. If the sum of the roll is a 7, then 0 is returned. Otherwise, -1 is returned. |
|
|
(5 pts) double adjust_bank_balance (double bank_balance, double wager_amount, int add_or_subtract) - If add_or_subtract is 1, then the wager amount is added to the bank_balance. If add_or_subtract is 0, then the wager amount is subtracted from the bank_balance. Otherwise, the bank_balance remains the same. The bank_balance result is returned. |
|
|
(5 pts) void chatter_messages (int number_rolls, int win_loss_neither, double initial_bank_balance, double current_bank_balance) - Prints an appropriate message dependent on the number of rolls taken so far by the player, the current balance, and whether or not the player just won his roll. The parameter win_loss_neither indicates the result of the previous roll. |
|
|
(10 pts) Others? |
|
|
(20 pts) A main ( ) function that makes use of the above functions in order to play the game of craps as explained above. Note that you will most likely have a loop in your main ( ) function (or you could have another function that loops through the game play). |
Have a great time with this assignment! There is plenty of room for creativity! Note: I have not stated how you must display the game play! You may do as you wish!
In: Computer Science
I am using C++
Write a program that allows two players to play a game of tic-tac-toe. Use a two-dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). The program should run a loop that does the following:
If a player wins, the program should immediately declare that player the winner and end. If a tie has occurred, the program should display an appropriate message and end. (You probably already know this, but just in case. Player 1 wins when there are three Xs in a row on the game board. The Xs can appear in a row, in a column, or diagonally across the board. Player 2 wins when there are three Os in a row on the game board. The Os can appear in a row, in a column, or diagonally across the board. A tie occurs when all of the locations on the board are full, but there is no winner.)
Note: Do not use global variables, except for global constants! You must create and use at least two functions, but are encouraged to modularize as much as possible. Each function must be named appropriately and obvious to what it does. The main function should have little more than an array for the board and call to the various functions. You should also define constants for the number of rows and columns and use them throughout the program. Make sure to check for valid input and ask again if necessary. Keep it simple and keep it clean! Here are some functions (not a complete list!) that I would suggest.
void displayBoard(char board[][COLS]);
void playerTurn(char board[][COLS], char player);
bool checkForWinner(char board[][COLS], char player);
bool isBoardFull(char board[][COLS]);
The output should look something like this -- user inputs are in bold blue type:
Columns
1 2 3
Row 1: * * *
Row 2: * * *
Row 3: * * *
Player X's turn.
Enter a row and column to place an X.
Row: 1
Column: 2
Columns
1 2 3
Row 1: * X *
Row 2: * * *
Row 3: * * *
Player O's turn.
Enter a row and column to place an O.
Row: 1
Column: 2
That location is not available. Select another location.
Row: 4
Invalid Row!
Row: 2
Column: 3
Columns
1 2 3
Row 1: * X *
Row 2: * * O
Row 3: * * *
Player X's turn.
Enter a row and column to place an X.
Row: 3
Column: 1
Columns
1 2 3
Row 1: * X *
Row 2: * * O
Row 3: X * *
Player O's turn.
Enter a row and column to place an O.
Row: 2
Column: 1
Columns
1 2 3
Row 1: * X *
Row 2: O * O
Row 3: X * *
Player X's turn.
Enter a row and column to place an X.
Row: 2
Column: 2
Columns
1 2 3
Row 1: * X *
Row 2: O X O
Row 3: X * *
Player O's turn.
Enter a row and column to place an O.
Row: 1
Column: 3
Columns
1 2 3
Row 1: * X O
Row 2: O X O
Row 3: X * *
Player X's turn.
Enter a row and column to place an X.
Row: 3
Column: 2
Columns
1 2 3
Row 1: * X O
Row 2: O X O
Row 3: X X *
Player 1 (X) WINS!!!!!
Compile, run, and test your program. Make sure there are no errors
and it functions properly. You can hit [Ctrl or command]+[Shift]+B
to compile and run the program. Your program must run without
errors to get full credit! Commit and push (upload) your repo,
including your cpp file to GitHub for grading. It must be named
correctly and saved as a readable cpp file with the proper
extension.
In: Computer Science
Write a program that allows two players to play a game of tic-tac-toe. Use a two-dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). The program should run a loop that does the following:
If a player wins, the program should immediately declare that player the winner and end. If a tie has occurred, the program should display an appropriate message and end. (You probably already know this, but just in case. Player 1 wins when there are three Xs in a row on the game board. The Xs can appear in a row, in a column, or diagonally across the board. Player 2 wins when there are three Os in a row on the game board. The Os can appear in a row, in a column, or diagonally across the board. A tie occurs when all of the locations on the board are full, but there is no winner.)
Note: Do not use global variables, except for global constants! You must create and use at least two functions, but are encouraged to modularize as much as possible. Each function must be named appropriately and obvious to what it does. The main function should have little more than an array for the board and call to the various functions. You should also define constants for the number of rows and columns and use them throughout the program. Make sure to check for valid input and ask again if necessary. Keep it simple and keep it clean! Here are some functions (not a complete list!) that I would suggest.
void displayBoard(char board[][COLS]);
void playerTurn(char board[][COLS], char player);
bool checkForWinner(char board[][COLS], char player);
bool isBoardFull(char board[][COLS]);
The output should look something like this -- user inputs are in bold blue type:
Columns
1 2 3
Row 1: * * *
Row 2: * * *
Row 3: * * *
Player X's turn.
Enter a row and column to place an X.
Row: 1
Column: 2
Columns
1 2 3
Row 1: * X *
Row 2: * * *
Row 3: * * *
Player O's turn.
Enter a row and column to place an O.
Row: 1
Column: 2
That location is not available. Select another location.
Row: 4
Invalid Row!
Row: 2
Column: 3
Columns
1 2 3
Row 1: * X *
Row 2: * * O
Row 3: * * *
Player X's turn.
Enter a row and column to place an X.
Row: 3
Column: 1
Columns
1 2 3
Row 1: * X *
Row 2: * * O
Row 3: X * *
Player O's turn.
Enter a row and column to place an O.
Row: 2
Column: 1
Columns
1 2 3
Row 1: * X *
Row 2: O * O
Row 3: X * *
Player X's turn.
Enter a row and column to place an X.
Row: 2
Column: 2
Columns
1 2 3
Row 1: * X *
Row 2: O X O
Row 3: X * *
Player O's turn.
Enter a row and column to place an O.
Row: 1
Column: 3
Columns
1 2 3
Row 1: * X O
Row 2: O X O
Row 3: X * *
Player X's turn.
Enter a row and column to place an X.
Row: 3
Column: 2
Columns
1 2 3
Row 1: * X O
Row 2: O X O
Row 3: X X *
Player 1 (X) WINS!!!!!
Compile, run, and test your program. Make sure there are no errors
and it functions properly. You can hit [Ctrl or command]+[Shift]+B
to compile and run the program. Your program must run without
errors to get full credit! Commit and push (upload) your repo,
including your cpp file to GitHub for grading. It must be named
correctly and saved as a readable cpp file with the proper
extension.
In: Computer Science
Programing assignment in C++
The following description has been adopted from Deitel & Deitel. One of the most popular games of chance is a dice game called "craps," which is played in casinos and back alleys throughout the world. The rules of the game are straightforward:
A player rolls two dice. Each die has six faces. These faces contain 1, 2, 3, 4, 5, and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. If the sum is 7 or 11 on the first throw, the player wins. If the sum is 2, 3, or 12 on the first throw (called "craps"), the player loses (i.e. the "house" wins). If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then the sum becomes the player's "point." To win, you must continue rolling the dice until you "make your point." The player loses by rolling a 7 before making the point.
Write a program that implements a craps game according to the above rules. The game should allow for wagering. This means that you need to prompt that user for an initial bank balance from which wagers will be added or subtracted. Before each roll prompt the user for a wager. Once a game is lost or won, the bank balance should be adjusted. As the game progresses, print various messages to create some "chatter" such as, "Sorry, you busted!", or "Oh, you're going for broke, huh?", or "Aw cmon, take a chance!", or "You're up big, now's the time to cash in your chips!"
Use the below functions to help you get started! You may define more than the ones suggested if you wish!
|
(5 pts) void print_game_rules (void) — Prints out the rules of the game of "craps". |
|
|
(5 pts) double get_bank_balance (void) - Prompts the player for an initial bank balance from which wagering will be added or subtracted. The player entered bank balance (in dollars, i.e. $100.00) is returned. |
|
|
(5 pts) double get_wager_amount (void) - Prompts the player for a wager on a particular roll. The wager is returned. |
|
|
(5 pts) int check_wager_amount (double wager, double balance) - Checks to see if the wager is within the limits of the player's available balance. If the wager exceeds the player's allowable balance, then 0 is returned; otherwise 1 is returned. |
|
|
(5 pts) int roll_die (void) - Rolls one die. This function should randomly generate a value between 1 and 6, inclusively. Returns the value of the die. |
|
|
(5 pts) int calculate_sum_dice (int die1_value, int die2_value) - Sums together the values of the two dice and returns the result. Note: this result may become the player's point in future rolls. |
|
|
(10 pts) int is_win_loss_or_point (int sum_dice) - Determines the result of thefirstdice roll. If the sum is 7 or 11 on the roll, the player wins and 1 is returned. If the sum is 2, 3, or 12 on the first throw (called "craps"), the player loses (i.e. the "house" wins) and 0 is returned. If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then the sum becomes the player's "point" and -1 is returned. |
|
|
(10 pts) int is_point_loss_or_neither (int sum_dice, int point_value) - Determines the result of any successive roll after the first roll. If the sum of the roll is the point_value, then 1 is returned. If the sum of the roll is a 7, then 0 is returned. Otherwise, -1 is returned. |
|
|
(5 pts) double adjust_bank_balance (double bank_balance, double wager_amount, int add_or_subtract) - If add_or_subtract is 1, then the wager amount is added to the bank_balance. If add_or_subtract is 0, then the wager amount is subtracted from the bank_balance. Otherwise, the bank_balance remains the same. The bank_balance result is returned. |
|
|
(5 pts) void chatter_messages (int number_rolls, int win_loss_neither, double initial_bank_balance, double current_bank_balance) - Prints an appropriate message dependent on the number of rolls taken so far by the player, the current balance, and whether or not the player just won his roll. The parameter win_loss_neither indicates the result of the previous roll. |
|
|
(10 pts) Others? |
|
|
(20 pts) A main ( ) function that makes use of the above functions in order to play the game of craps as explained above. Note that you will most likely have a loop in your main ( ) function (or you could have another function that loops through the game play). |
Have a great time with this assignment! There is plenty of room for creativity! Note: I have not stated how you must display the game play! You may do as you wish!
1-Your project must contain one header file (a .h file), two C source files (which must be .c files), and project workspace.
In: Computer Science
The engineered mutation should be in both strands, in order to maintain that mutation. If we insert a mismatch, the mutated strand will be newly syntheised one. Non-mutated strand will be the parental one. Systems evolved DNA methylation mechanisms to decrease such errors. Dam methylase is the best example for that. It methylates all GATC sequences in bacteria. If we take out bacterial parental DNA and engineer it with mismatch, parental strand will be methylated one and new strand will not be methylated. DNA repair system identifies parental strand based GATC methylation, removes mismatched bases from new strand and replaces with normal bases. This happens well before replication. So equal mixture of parental and mutated genome is not expected. Mismatch repair, goes according to parental strand and always decreases the frequency of mutations.
In: Biology