Suppose Monty Hall wants to make his game show more interesting. In the new version, there are 7 doors and 2 cars behind the doors. The other 5 doors have goats behind them. A contestant picks a door. Monty Hall opens 3 of the doors with goats behind them (never the door that the contestant picked or a door with a car). The contestant then has the choice of switching doors.find the probability that the contestant wins a car if he/she switches doors. Is it better to switch or stick with the original guess?
In: Statistics and Probability
Hi!
I have a question in Data communication and network please!
Make the “ping” return the following messages:
1_ Request Timed Out
2_Destination Network / Host unreachable
3_Time Exceeded
and explain the reasons.
I want to se result please, My computer is Mac.
Thanks!
In: Computer Science
(C++) Write version 1.0 of the Rider class for the elevator simulation. Riders will "know" their starting floor and their destination floor. But instead of using pointers or reference variables as data members, they use whole number int s. (The simulation will have an array of floor objects to which all classes will have access, so all that's needed to refer to a floor is its index in the global array.)
Here's its specification:
As the only data members, two constant whole numbers representing the start and destination floors. Name then to and from , but as int s. (Two more data members will be added later.)
One constructor with two parameters -- the indexes of the start and destination floors, in that order, to be copied to the data members in an initializer list.
An overloaded assignment operator, so objects can be added to STL vectors and queues.
Write an H and a CPP. Don't write the constructor inline (because we'll add to it in a later version).
Since all members are public, write this as a struct .
The Rider class declaration for Rider.h,
Test it with this _testRider.cpp. Compile like this:
c++ -std=c++11 _testRider.cpp Rider.cpp -Wall
This is not the first full and complete "building block" in our elevator simulation, but it's a start.
Submit Rider.cpp and Rider.h.
In: Computer Science
College playboy “Studley” Moore likes to throw lavish parties in his spacious Davis apartment. He has one quirk though. He insists that every guest, on their way in, play a game of “odd or even” with him. Each of the two sticks out one or two fingers, and Studley wins if the sum is even. Studley pays the guest $5 when the sum is odd (i.e., there are oneor three fingers showing), but he collects $6 when the sum is two and $4 when the sum is four. Suppose that Studley uses the strategy of sticking out one finger with probability 7/12 and two fingers with probability 5/12. Assume that each guest chooses one or two fingers with equal probability. Find the probability distribution for Studley's winnings W in a game of odd or even, and compute Studley's expected winnings in this game. Would always sticking out one finger be a better strategy for Studley (up until he gets found out)?
In: Statistics and Probability
Two players, 1 and 2, take turns choosing numbers; 1 goes first. On his turn, a player may choose any number between 1 and 10, inclusive, and this number is added to a running total. When the running total of both players’ choices reaches 100, the game ends. The player whose choice of number takes the total to exactly 100 is the winner.
(i) Who wins the game when we solve it using backwards induction?
(ii) Provide a (not necessarily formal), description of the winner’s moves that conform with backward induction.
In: Economics
Write a function that removes all even numbers from an array. The function should take the array, length of the array, and a pointer for number of odd numbers found as arguments and return a pointer to the new array. If there are no odd numbers found in the array, your code should print "No odds found." and return NULL.
Use the function header:
int *removeEvens(int *a, int length, int *oddsFound);
Example:
Input array a[ ] = {3, 4, 5, 6, 7}
*oddsFound = 3
return array = {3, 5, 7}
The size of the return array needs to be the number of odd numbers found.
Note: You can determine if a number is even by checking if a[x] % 2 == 0.
In: Computer Science
Program 5A: Determine which student has the highest grade Write a Java program that determines which student has the highest grade. You will ask the user to enter the number of students. Then you will ask for each student and their grade. You will output the name and grade of the student with the highest grade. You will NOT use an array for this assignment.
Call your class Program5A, so your filename will be Program5A.java. It is essential for grading purposes that everyone have the same class name. 2. Create several lines of comments of identification and description at the top of the file (it doesn’t have to look exactly like this, in particular, if your editor wants to put * in front of every line, that’s fine):
Use comments liberally to document exactly what you are doing in the program. 4. Use descriptive variable names in camel-case with the first letter in lowercase. 5. Ask the user for the number of students and assign that to a variable of type int called numStudents using the nextInt method of Scanner.
At this point, try to compile and run your program. Don’t move on until this part is working. It would be good to enter a temporary print statement just to make sure this is working: System.out.printf("numStudents = %d\n", numStudents); It should be commented out before turning in the program (put // in front of it) or delete the line.
We need variables for highestName and highestScore of types String and int, respectively. Set highestName to the empty string and highestScore to 0.
Create a for loop. (Do NOT put a semi-colon after the for statement. Put an open curly brace instead, and go ahead and put the closing brace if your IDE doesn’t do it automatically, then put all the statement to be repeated BETWEEN the curly braces):
for (int i = 0; i < numStudents; i++) { a. As the first statement in the loop, add an extra line that reads to the end of the line: input.nextLine(); This is needed after a nextInt if you are going to then read a String. This basically burns the rest of the line (it ignores everything else to and including the end of the line which in this case will just be an end-of-line character '\n'), even though there is nothing there that you can see. You will need to do this any time that you have read in an int as you did for the number of students. (You could have done it right after you read the number of students, but then you would have to do it again in the loop right after reading the score. Doing it here takes care of both with one line of code.) b. Ask the user for name and score, which will be String and int types, respectively, which will require nextLine and nextInt. c. Compare score to highestScore. If score is greater than highestScore, then assign highestScore equal to score and highestName equal to name. There will not be an else. (If they are equal, we are NOT going to change the highest score so that in the event of a tie, the first one wins. However, in real life we would deal with ties in a better manner.) d. This is the end of the for loop, so put the closing brace if it’s not already there.
Outside of the for loop, print highestName and highestScore
ample Runs: (Enter this data exactly and make screen-prints to paste into a Word document that you will turn in to prove that your program works correctly. On the last one, just hit the Enter key without entering anything; it should sit there still waiting for integer input; if you then enter an integer, everything is fine and works like normal.):
Please enter number of students:4
Enter student name:Gus
Enter score:70
Enter student name:Suzy
Enter score:80
Enter student name:Allie
Enter score:100
Enter student name:Robert
Enter score:90
Highest score: Allie 100
Process finished with exit code 0
In: Computer Science
Executive Summary
The executive summary is a company marketing document intended to excite potential investors, customers, advisers, and employees. Its purpose is to get the call back and start the serious discussions—the process that will result in action.
Your executive summary should include:
This paper should have a title page, abstract (the elevator speech), body, and reference page. Points will be deducted if any of these four sections are missing. Make sure papers are written in correct APA style.
The executive summary should be between 400-600 words (not including the elevator speech/abstract), double space, and use font size 12. Structure the paper along the lines advised above.
In: Economics
Recommend multiple procedures to improve a piston ventilator design and some tests to verify its design.
In: Nursing
zyDE 9.16.1: Dice game Craps.
// Simulates a dice game called Craps
import java.util.Random;
import java.text.DecimalFormat;
import java.util.Scanner;
public class Craps {
// Game statistics
private int diceTotal;
private int credits;
private int numTurns;
private int numWins;
private int highCredits;
private int startCredits;
// Random number generator to simulate dice
private Random diceThrower;
// Constructor initializes instance members
public Craps() {
diceTotal = 0;
diceThrower = new Random();
}
// Return current credits
public int getCredits() {
return credits;
}
// Set number of credits and check for
// negative values
public void setCredits(int amount) {
credits = 0;
if (amount > 0) {
credits = amount;
}
}
// Generates two random numbers (1 - 6)
// to simulate two dice
private void rollDice() {
int d1 = diceThrower.nextInt(6) + 1;
int d2 = diceThrower.nextInt(6) + 1;
diceTotal = d1 + d2;
}
// Update statistics when player wins
private void playerWins() {
++credits;
++numWins;
// FIX ME: update highCredits if new high is achieved
highCredits = credits;
}
// Print game statistics
private void printStatistics() {
DecimalFormat fmt = new DecimalFormat("#,###.#");
double percentWins = ((double) numWins / numTurns) * 100.0;
System.out.println("\n\nGame Results");
System.out.println("Start Credits: " +
fmt.format(startCredits));
System.out.println("Turns: " + fmt.format(numTurns));
System.out.println("Wins: " + fmt.format(numWins)
+ " (" + fmt.format(percentWins) + "%)");
System.out.println("High Credits: " +
fmt.format(highCredits));
}
// Set game statistics to starting conditions
private void resetStatistics() {
numTurns = 0;
numWins = 0;
highCredits = 0;
startCredits = credits;
}
// Simulates one player turn
// Returns true if player wins and false if player loses
public boolean takeOneTurn() {
boolean playerWon;
// Player takes initial roll
rollDice();
// FIX ME: Increment numTurns
// Player wins with 7 or 11
if (diceTotal == 7 || diceTotal == 11) {
playerWon = true;
playerWins();
}
// Player loses with 2, 3 or 12
else if (diceTotal <= 3 || diceTotal == 12) {
playerWon = false;
--credits;
}
// Player keeps rolling until 7 or the point
else {
int point = diceTotal;
do {
rollDice();
} while (diceTotal != point && diceTotal != 7);
// Player wins with the point
if (diceTotal == point) {
playerWon = true;
playerWins();
}
// Player loses with 7
else {
playerWon = false;
--credits;
}
}
return playerWon;
}
// Play a specified number of turns and track
// the percentage of player wins
public void takeMultipleTurns(int numTurns) {
setCredits(10);
resetStatistics();
for (int i = 0; i < numTurns; ++i) {
takeOneTurn();
}
}
// Play until credits = 0 given a starting amount
public void playUntilBroke(int startingCredits) {
setCredits(startingCredits);
resetStatistics();
while (credits > 0) {
takeOneTurn();
}
}
// main() method uses an object of type Craps
public static void main(String [] args) {
Scanner scnr = new Scanner(System.in);
Craps crapsGame = new Craps();
int startCredits = 10;
// Continue as long as player chooses to
do {
crapsGame.playUntilBroke(startCredits);
crapsGame.printStatistics();
System.out.print("Enter starting credits (0 to quit): ");
startCredits = scnr.nextInt();
} while (startCredits > 0);
System.out.println("\nGood bye...");
}
}
In: Computer Science