In: Physics
In: Physics
Daily commute time is normally distributed with mean=40 minutes and standard deviation=8 minutes. For 16 days of travel, what is the probability of an average commute time greater than 35? B. A cup holds 18 ozs. The beer vending machine has an adjustable mean and a standard deviation equal to .2 oz. What should the mean be set to so that the cup overflows only 2.5% of the time? C. The probability that Rutgers soccer team wins a game is .6. What is the probability they win 10 or more of the 14 games?
In: Statistics and Probability
In C++
In this lab we will creating two linked list classes: one that is a singly linked list, and another that is a doubly linked list ( This will be good practice for your next homework assignment where you will build your own string class using arrays and linked list ) .
These LinkedList classes should both be generic classes. and should contain the following methods:
Add - Adds element to the end of the linked list.
IsEmpty
Push - Adds element to the beginning of the linked list
InsertAt - Inserts an element at a given position
Clear - Removes all elements from the linked list
Contains - Returns true if element is in the linked list
Get - Returns a value at a specific position
IndexOf - Returns the first position where an element occurs, -1 if not
LastOf - Returns the last position where an element occurs, -1 if not
Remove - Removes the last item added to the list
RemoveAt - Removes an element at a specific position
RemoveElement - Removes the first occurrence of a specific element
Size
Slice - Returns a subset of this linked list given a beginning position start and end position stop.
You will also count the number of operations that is performed in each method and will calculate the RUN-TIME of each method, as well as calculating the BIG O, OMEGA and THETA notation of each method. This information should be written in a comment block before each method ( you may count the number of operations on each line if you want ).
You are required to write self commenting code for this Lab, refer to the Google Style Sheet if you haven't become familiar with it.
In: Computer Science
In Java
In this lab we will creating two linked list classes: one that is a singly linked list, and another that is a doubly linked list ( This will be good practice for your next homework assignment where you will build your own string class using arrays and linked list ) .
These LinkedList classes should both be generic classes. and should contain the following methods:
Add - Adds element to the end of the linked list.
IsEmpty
Push - Adds element to the beginning of the linked list
InsertAt - Inserts an element at a given position
Clear - Removes all elements from the linked list
Contains - Returns true if element is in the linked list
Get - Returns a value at a specific position
IndexOf - Returns the first position where an element occurs, -1 if not
LastOf - Returns the last position where an element occurs, -1 if not
Remove - Removes the last item added to the list
RemoveAt - Removes an element at a specific position
RemoveElement - Removes the first occurrence of a specific element
Size
Slice - Returns a subset of this linked list given a beginning position start and end position stop.
You will also count the number of operations that is performed in each method and will calculate the RUN-TIME of each method, as well as calculating the BIG O, OMEGA and THETA notation of each method. This information should be written in a comment block before each method ( you may count the number of operations on each line if you want ).
You are required to write self commenting code for this Lab, refer to the Google Style Sheet if you haven't become familiar with it.
In: Computer Science
Background:
In the game “Rock, Paper, and Scissors,” two players simultaneously say (or display a hand symbol representing) either “rock,” “paper,” or “scissors.” The winner is the one whose choice wins over the other. The rules are: paper wins over (wraps) rock, rock wins over (breaks) scissors, and scissors wins over (cuts) paper.
Assignment:
A customer wants you to design and implement a program (RPS.py) for playing the game of “Rock, Paper, Scissors” for a single player against the computer. The player/user is to be prompted to enter a letter representing their turn in the game: R or r for rock, P or p for paper, S or s for scissors, and Q or q for quit. The computer will take its turn as player 2 to select a choice of rock (1 = R or r), paper (2 = P or p) or scissors (3 = S or s).
So if:
Player enters R
Computer randomly chooses the number 3 (aka. Scissors)
Player wins - rock wins over (breaks) scissors,
Once the program ends, it should display/output the Total Attempts, Total Valid Attempts, along with the number of human player wins, losses and ties.
Question:
1)
What would happen if the customer asked you to change the program to be Rock, Paper, Lizard, Scissors, & Spock?
From the popular TV Show The Big Bang Theory, the rules are as the character Sheldon explains, "Scissors cuts paper, paper covers rock, rock crushes lizard, lizard poisons Spock, Spock smashes scissors, scissors decapitates lizard, lizard eats paper, paper disproves Spock, Spock vaporizes rock, and as it always has, rock crushes scissors."
Describe what portion of the code/logic would need to change in the code? How many combinations does the program need to support now?
2)Test your code and show at least 3 iterations and the final output for the original customer problem.
In: Computer Science
Consider a sample of 46 football games, where 26 of them were won by the home team. Use a 0.10 significance level to test the claim that the probability that the home team wins is greater than one-half.
Identify the test statistic for this hypothesis test.
H=
Identify P value
p=
P=
In: Statistics and Probability
Consider a second price auction with 2 bidders, 1 and 2, who have values for the good of 20 and 80, respectively. Each knows what the other bidder’s valuation is so there is no uncertainty.
(a) Show that choosing a bid equal to one’s valuation is a weakly dominant strategy for bidder 1.
(b) Show that if each bidder plays a weakly dominant strategy, the bidder with the highest value always wins the good
(c) Is it a Nash equilibrium for bidder 1 to bid 60 and bidder 2 to bid 80? Which bidder is playing a weakly dominated strategy?
In: Economics
There are three dices, a person tosses 3 dices every time. If the number of three dices is in 3-10, he loses the game; If the number of three dices is in 11-18, he wins the game. Find out the chances (rate) of winning the prize.
In: Statistics and Probability
Can someone tell me what is wrong with this code?
Python pong game using graphics.py
When the ball moves the paddles don't move and when the paddles move the ball doesn't move.
from graphics import *
import time, random
def racket1_up(racket1):
racket1.move(0,20)
def racket1_down(racket1):
racket1.move(0,-20)
def racket2_up(racket2):
racket2.move(0,20)
def racket2_down(racket2):
racket2.move(0,-20)
def bounceInBox(shape, dx, dy, xLow, xHigh, yLow, yHigh):
delay = .005
for i in range(600):
shape.move(dx, dy)
center = shape.getCenter()
x = center.getX()
y = center.getY()
if x < xLow:
dx = -dx
elif x > xHigh:
dx = -dx
if y < yLow:
dy = -dy
elif y > yHigh:
dy = -dy
time.sleep(delay)
def getRandomPoint(xLow, xHigh, yLow, yHigh):
x = random.randrange(xLow, xHigh+1)
y = random.randrange(yLow, yHigh+1)
return Point(x, y)
def makeDisk(center, radius, win):
disk = Circle(center, radius)
disk.setOutline("orange")
disk.setFill("orange")
disk.draw(win)
return disk
def createRacket1(win):
#racket 1
racket1 = Rectangle(Point(5,1),Point(10,70))
racket1.setOutline("red")
racket1.setFill("red")
racket1.draw(win)
racket1.move(580,170)
return racket1
def createRacket2(win):
racket2 = Rectangle(Point(5,1),Point(10,70))
racket2.setOutline("blue")
racket2.setFill("blue")
racket2.draw(win)
racket2.move(5,170)
return racket2
def movePaddles(racket1,racket2,win):
while True:
#move racket
key = win.checkKey()
if key == "q":
break
elif key == "Up":
racket1_up(racket1)
elif key == "Down":
racket1_down(racket1)
elif key == "a":
racket2_up(racket2)
elif key == "z":
racket2_down(racket2)
def bounceBall(dx, dy):
winWidth = 600
winHeight = 400
win = GraphWin("Ping Pong", winWidth, winHeight)
win.setBackground("green")
win.setCoords(0,0,winWidth, winHeight)
radius = 8
xLow = radius
xHigh = winWidth - radius
yLow = radius
yHigh = winHeight - radius
center = getRandomPoint(xLow, xHigh, yLow, yHigh)
ball = makeDisk(center, radius, win)
paddle1 = createRacket1(win)
paddle2 = createRacket2(win)
bounceInBox(ball, dx, dy, xLow, xHigh, yLow, yHigh)
movePaddles(paddle1,paddle2,win)
win.close()
bounceBall(3, 5)
In: Computer Science