roman_numerals_buggy/package.bluej
#BlueJ package file
dependency1.from=RomanNumeralsTest
dependency1.to=RomanNumerals
dependency1.type=UsesDependency
package.editor.height=400
package.editor.width=560
package.editor.x=733
package.editor.y=118
package.numDependencies=1
package.numTargets=2
package.showExtends=true
package.showUses=true
target1.editor.height=700
target1.editor.width=900
target1.editor.x=623
target1.editor.y=216
target1.height=50
target1.name=RomanNumeralsTest
target1.naviview.expanded=false
target1.showInterface=false
target1.type=UnitTestTarget
target1.width=140
target1.x=70
target1.y=70
target2.editor.height=700
target2.editor.width=900
target2.editor.x=578
target2.editor.y=92
target2.height=50
target2.name=RomanNumerals
target2.naviview.expanded=false
target2.showInterface=false
target2.type=ClassTarget
target2.width=120
target2.x=70
target2.y=10
roman_numerals_buggy/README.TXT
------------------------------------------------------------------------
This is the project README file. Here, you should describe your project.
Tell the reader (someone who does not know anything about this project)
all he/she needs to know. The comments should usually include at least:
------------------------------------------------------------------------
PROJECT TITLE:
PURPOSE OF PROJECT:
VERSION or DATE:
HOW TO START THIS PROJECT:
AUTHORS:
USER INSTRUCTIONS:
roman_numerals_buggy/RomanNumerals.classpublicsynchronizedclass RomanNumerals {
public void RomanNumerals();
public String toRoman(int);
}
roman_numerals_buggy/RomanNumerals.ctxt
#BlueJ class context
comment0.params=n
comment0.target=java.lang.String\ toRoman(int)
numComments=1
roman_numerals_buggy/RomanNumerals.javaroman_numerals_buggy/RomanNumerals.javapublicclassRomanNumerals
{
publicString toRoman(int n){
String r ="";
while( n >0){
if(n>=1000){
r +="M";
n -=1000;
}elseif( n >500){
r +="D";
n -=500;
}elseif(n>=100){
r +="C";
n -=100;
}elseif(n>=50){
r +="L";
n -=50;
}elseif(n >=10){
r +="X";
n -=10;
}elseif(n >=5){
r +="V";
n -=5;
}else{
r +="I";
n -=1;
}
}
return r;
}
}
roman_numerals_buggy/RomanNumeralsTest.classpublicsynchronizedclass RomanNumeralsTest extends junit.framework.TestCase {
public void RomanNumeralsTest();
protected void setUp();
protected void tearDown();
public void test_1();
public void test_3();
public void test_8();
public void test_27();
public void test_2011();
public void test_44();
public void test555();
public void test500();
}
roman_numerals_buggy/RomanNumeralsTest.ctxt
#BlueJ class context
comment0.params=
comment0.target=RomanNumeralsTest()
comment0.text=\r\n\ Default\ constructor\ for\ test\ class\ RomanNumeralsTest\r\ ...
4. roman_numerals_buggy/RomanNumerals.classpublicsynchroniz
edclass RomanNumerals {
public void RomanNumerals();
public String toRoman(int);
}
roman_numerals_buggy/RomanNumerals.ctxt
#BlueJ class context
comment0.params=n
comment0.target=java.lang.String toRoman(int)
numComments=1
roman_numerals_buggy/RomanNumerals.javaroman_numerals_b
uggy/RomanNumerals.javapublicclassRomanNumerals
{
publicString toRoman(int n){
String r ="";
while( n >0){
if(n>=1000){
r +="M";
n -=1000;
}elseif( n >500){
r +="D";
n -=500;
}elseif(n>=100){
r +="C";
n -=100;
}elseif(n>=50){
r +="L";
n -=50;
5. }elseif(n >=10){
r +="X";
n -=10;
}elseif(n >=5){
r +="V";
n -=5;
}else{
r +="I";
n -=1;
}
}
return r;
}
}
roman_numerals_buggy/RomanNumeralsTest.classpublicsynchr
onizedclass RomanNumeralsTest extends
junit.framework.TestCase {
public void RomanNumeralsTest();
protected void setUp();
protected void tearDown();
public void test_1();
public void test_3();
public void test_8();
public void test_27();
public void test_2011();
public void test_44();
public void test555();
public void test500();
}
roman_numerals_buggy/RomanNumeralsTest.ctxt
#BlueJ class context
6. comment0.params=
comment0.target=RomanNumeralsTest()
comment0.text=rn Default constructor for test class
RomanNumeralsTestrn
comment1.params=
comment1.target=void setUp()
comment1.text=rn Sets up the test fixture.rnrn Called
before every test case method.rn
comment10.params=
comment10.target=void test500()
comment2.params=
comment2.target=void tearDown()
comment2.text=rn Tears down the test fixture.rnrn
Called after every test case method.rn
comment3.params=
comment3.target=void test_1()
comment4.params=
comment4.target=void test_3()
comment5.params=
comment5.target=void test_8()
8. publicRomanNumeralsTest()
{
}
/**
* Sets up the test fixture.
*
* Called before every test case method.
*/
protectedvoid setUp()
{
}
/**
* Tears down the test fixture.
*
* Called after every test case method.
*/
protectedvoid tearDown()
{
}
publicvoid test_1()
{
RomanNumerals romanNum1 =newRomanNumerals();
assertEquals("I", romanNum1.toRoman(1));
}
publicvoid test_3()
{
RomanNumerals romanNum1 =newRomanNumerals();
assertEquals("III", romanNum1.toRoman(3));
}
publicvoid test_8()
{
10. 00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
1. The histograms each represent (a) P(x) (b) P(x)
part of a binomial distribution. 0. 0.
Each distribution has the same 0. 0.
probability of success, p, but
0. 0. different numbers of trials, n.
Identify the unusual values of x
in each histogram.
x
(a) n =4
012345678910 012345678910 (b) n = 8
(a) Choose the correct answer below. Use histogram (a).
QA. x = 5, x = 6, x = 7, and x = 8
QB. x= 1
QC. x=4
11. QD. There are no unusual values ofx in the histogram.
(b) Choose the correct answer below. Use histogram (b).
QA. x =4
QB. x=5,x=6,x=7,andx=8
QC. x=2
QD. There are no unusual values ofx in the histogram.
Page 1
00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
2. About 10% of babies born with a certain ailment recover
fully. A hospital is caring for six
babies born with this ailment. The random variable represents
the number of babies that
recover fully. Decide whether the experiment is a binomial
experiment. If it is, identify a
success, specify the values of n, p, and q, and list the possible
values of the random variable x.
Is the experiment a binomial experiment?
0 Yes
0 No
What is a success in this experiment?
12. O This is not a binomial experiment.
0 Baby recovers
O Baby doesn't recover
Specify the value of n. Select the correct choice below and fill
in any answer boxes in your
choice.
QA. n=D
0 B. This is not a binomial experiment.
Specify the value of p. Select the correct choice below and fill
in any answer boxes in your
choice.
QA. p=D
OB. This is not a binomial experiment.
Specify the value of q. Select the correct choice below and fill
in any answer boxes in your
choice.
QA. q=D
0 B. This is not a binomial experiment.
List the possible values of the random variable x.
Page 2
00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
13. 2.
(cont.) 0 x = 0, 1, 2, ... , 5
0 x=l,2,3, ... ,6
0 x=0,1,2, ... ,6
O This is not a binomial experiment.
3. Find the mean, variance, and standard deviation of the
binomial distribution with the given
values of n and p.
n = 121, p = 0.56
The mean, µ, is D. (Round to the nearest tenth as needed.)
The variance, cr2, is D. (Round to the nearest tenth as needed.)
The standard deviation, o, is D. (Round to the nearest tenth as
needed.)
4. 63% of men consider themselves professional baseball fans.
You randomly select 10 men and
ask each if he considers himself a professional baseball fan.
Find the probability that the
number who consider themselves baseball fans is (a) exactly
eight, (b) at least eight, and (c)
less than eight. If convenient, use technology to find the
probabilities.
(a) P(8) =D (Round to the nearest thousandth as needed.)
(b) P(x :'.:: 8) =D (Round to the nearest thousandth as needed.)
(c) P(x < 8) =D (Round to the nearest thousandth as needed.)
Page 3
14. 00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
5. Forty percent of households say they would feel secure if
they had $50,000 in savings. You
randomly select 8 households and ask them if they would feel
secure if they had $50,000 in
savings. Find the probability that the number that say they
would feel secure is (a) exactly five,
(b) more than five, and ( c) at most five.
(a) Find the probability that the number that say they would feel
secure is exactly five.
P(5)= D
(Round to three decimal places as needed.)
(b) Find the probability that the number that say they would feel
secure is more than five.
P(x>5)=0
(Round to three decimal places as needed.)
( c) Find the probability that the number that say they would
feel secure is at most five.
P(x~5)=0
(Round to three decimal places as needed.)
6. 31 % of adults say cashews are their favorite kind of nut. You
randomly select 12 adults and
ask each to name his or her favorite nut. Find the probability
15. that the number who say cashews
are their favorite nut is (a) exactly three, (b) at least four, and (
c) at most two. If convenient,
use technology to find the probabilities.
(a) P(3) =D (Round to the nearest thousandth as needed.)
(b) P(x ~ 4) = D (Round to the nearest thousandth as needed.)
(c) P(x ~ 2) =D (Round to the nearest thousandth as needed.)
Page4
00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
7. 22% of college students say they use credit cards because of
the rewards program. You
randomly select 10 college students and ask each to name the
reason he or she uses credit
cards. Find the probability that the number of college students
who say they use credit cards
because of the rewards program is (a) exactly two, (b) more
than two,
and ( c) between two and five inclusive. If convenient, use
technology to find the probabilities.
(a) P(2) =D (Round to the nearest thousandth as needed.)
(b) P(x > 2) =D (Round to the nearest thousandth as needed.)
( c) P ( 2 ~ x ~ 5) = D (Round to the nearest thousandth as
needed.)
Page 5
16. 00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
8. 36% of women consider themselves fans of professional
baseball. You randomly select six
women and ask each if she considers herself a fan of
professional baseball.
(a) Construct a binomial distribution using n = 6 and p = 0.36.
x P(x)
0 D
1 D
2 D
3 D
4 D
5 D
6 D
(Round to the nearest thousandth as needed.)
(b) Choose the correct histogram for this distribution below.
OA. OB. Oc. OD.
0 2 4 6
(c) Describe the shape of the histogram.
QA. Skewed left
QB. Skewed right
QC. Symmetrical
17. QD. None of these
(d) Find the mean of the binomial distribution.
µ = D (Round to the nearest tenth as needed.)
Page 6
00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
8.
(cont.)
(e) Find the variance of the binomial distribution.
cr2 = D (Round to the nearest tenth as needed.)
(f) Find the standard deviation of the binomial distribution.
er= D (Round to the nearest tenth as needed.)
(g) Interpret the results in the context of the real-life situation.
What values of the random
variable would you consider unusual? Explain your reasoning.
On average, D out of 6 women would consider themselves
baseball fans, with a standard
deviation of D women. The values x = 6 and x = D would be
unusual
less than
because their probabilities are more than 0.05.
18. equal to
9. Given that x has a Poisson distribution with µ = 5, what is
the probability that x = O?
P(O) ~ D (Round to four decimal places as needed.)
10. Given that x has a Poisson distribution withµ= 1.8, what is
the probability that x = 5?
P(5) ~ D (Round to four decimal places as needed.)
Page 7
00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
11. Decide which probability distribution - binomial, geometric,
or Poisson - applies to the
question. You do not need to answer the question.
Given: Of students ages 16 to 18 with A or B averages who plan
to attend college after
graduation, 70% cheated to get higher grades. Ten randomly
chosen students with A or B
to attend college after graduation were asked if they cheated to
get higher grades. Question:
What is the probability that exactly two students answered no?
What type of distribution applies to the given question?
QA. Poisson distribution
19. QB. Geometric distribution
QC. Binomial distribution
12. Decide which probability distribution - binomial, geometric,
or Poisson - applies to tbe
question.You do not need to answer the question. Instead,
justify your choice.
Given: The mean number of oil tankers at a port city is 10 per
day. The port has facilities to
handle up to 15 oil tankers in a day.
Question: What is the probability that too many tankers will
arrive on a given day?
Choose the correct probability distribution below.
QA. Binomial. You are interested in counting the number of
successes out of n trials.
OB. Geometric. You are interested in counting the number of
trials until the first success.
QC. Poisson. You are interested in counting the number of
occurrences that take place
within a given unit of time.
Page 8
00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
13. Find the indicated probabilities using the geometric
20. distribution or Poisson distribution. Then
determine if the events are unusual. If convenient, use a Poisson
probability table or
technology to find the probabilities.
Assume the probability that you will make a sale on any given
telephone call is 0.18. Find the
probability that you (a) make your first sale on the fifth call, (b)
make your sale on the first,
second, or third call, and (c) do not make a sale on the first
three calls.
(a) P(make your first sale on the fifth call)= D
(Round to three decimal places as needed.)
(b) P(make your sale on the first, second, or third call)= D
(Round to three decimal places as needed.)
( c) P( do not make a sale on the first three calls) = D
(Round to three decimal places as needed.)
Which of the events are unusual? Select all that apply.
DA. The event in part (a), "make your first sale on the fifth
call", is unusual.
DB. The event in part (b ), "make your sale on the first, second,
or third call", is unusual.
oc. The event in part (c), "do not make a sale on the first three
calls", is unusual.
OD. None of the events are unusual.
Page 9
21. 00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
14. Find the indicated probabilities using the geometric
distribution or Poisson distribution. Then
determine if the events are unusual. If convenient, use a Poisson
probability table or
technology to find the probabilities.
A newspaper finds that the mean number of typographical errors
per page is nine. Find the
probability that (a) exactly five typographical errors are found
on a page, (b) at most five
typographical errors are found on a page, and ( c) more than
five typographical errors are found
on a page.
(a) P(exactly five typographical errors are found on a page)= D
(Round to four decimal places as needed.)
(b) P( at most five typographical errors are found on a page) =
D
(Round to four decimal places as needed.)
(c) P(more than five typographical errors are found on a page)=
D
(Round to four decimal places as needed.)
Which of the events are unusual? Select all that apply.
DA. The event in part (a) is unusual.
DB. The event in part (b) is unusual.
oc. The event in part (c) is unusual.
OD. None of the events are unusual.
22. Page 10
00)
Book: Larson: Elementary Statistics:
Picturing the World, Se
15. Find the indicated probabilities using the geometric
distribution or Poisson distribution. Then
determine if the events are unusual. If convenient, use a Poisson
probability table or
technology to find the probabilities.
A major hurricane is a hurricane with wind speeds of 111 miles
per hour or greater. During the
last century, the mean number of major hurricanes to strike a
certain country's mainland per
year was about 0.67. Find the probability that in a given year
(a) exactly one major hurricane
will strike the mainland, (b) at most one major hurricane will
strike the mainland, and (c) more
than one major hurricane will strike the mainland.
(a) P(exactly one major hurricane will strike the mainland)= D
(Round to three decimal places as needed.)
(b) P(at most one major hurricane will strike the mainland)= D
(Round to three decimal places as needed.)
(c) P(more than one major hurricane will strike the mainland)=
D
(Round to three decimal places as needed.)
Which of the events are unusual? Select all that apply.
23. DA. The event in part (a) is unusual.
DB. The event in part (b) is unusual.
oc. The event in part (c) is unusual.
DD. None of the events are unusual.
Page 11