Questions
write a method called Comparisons that will return the number of comparisons to find an element...

write a method called Comparisons that will return the number of comparisons to find an element in the tree. The main program calls this method for each element, adding the comparisons each time in order to count the total number of comparisons. The program then outputs the total number of comparisons and the average number. You may use the program BuildTreeWIthMethod to build your tree. Then, after you have made the call to inOrder(root), add the following code:

int totalComparisons=0;

for (int i = 0; i < arr.length; i++) {
totalComparisons=totalComparisons + Comparisons(root, arr[i]);
}

System.out.println("Number of comparisons to find all data in tree is " + totalComparisons);
System.out.println("Average number of comparisons is " + totalComparisons*1.0/arr.length);

To be clear: you ONLY have to write the method and to put the code above into your program - use the program I gave to you.

2. Repeat the above for strings in an input file. The input file is here. words2.txt

In each case work the tree by hand (pencil and paper) so you know what the answer should be. You can EITHER submit two programs OR put both into one program. Your choice.

FOR THIS LAB it is OK if you have to write two TreeInsert methods (one for Integer, one for Strings), and two Comparisons methods (you can write template methods in the next lab) - but if you put template methods in here that is good too. ALSO the integers are in an array, but the Strings are in a file. So after you have built a tree of Strings you either have to close the input file, then reopen it and pick up each word again and calculate the number of comparisons to find it, or you have to look for another solution. (Possibilities are to read them into an array at the beginning before building your tree or count comparisons in the same loop where you read in your string. Either is fine (for now)).

words2.txt
Hi
Bye
Monday
April
Donkey
Yellow
Computers
Monkey
Dog
Cat

In: Computer Science

You receive the Dean’s Scholarship which pays you RMB 100,000 annually for 3 years. The first...

You receive the Dean’s Scholarship which pays you RMB 100,000 annually for 3 years. The first payment will be made one year from today. What is the Present Value of these 3 payments if interest rate is 3% p.a.? A. RMB 246,168 B. RMB 257,710 C. RMB 267,301 D. RMB 282,861 E. RMB 288,388

A bank manager tells you the monthly rate is 0.5%. What is the Effective Annual Rate? A. 2.43% B. 3.66% C. 6.17% D. 12.68% E. 79.58%

The Annual Percentage Rate is 12%. What is the semi-annually rate? A. 1% B. 2% C. 3% D. 4% E. 6%

The nominal interest rate is 8% p.a. and the inflation rate is 6% p.a. Determine the real interest rate using the exact method. A. 1.02% p.a. B. 1.69% p.a. C. 1.89% p.a. D. 1.98% p.a. E. 2.56% p.a

What is the price of a 5.0% annual coupon bond with a $1,000 face value which matures in 5 years? The yield-to-maturity (YTM) is 3.0% p.a. A. $ 913.42 B. $ 945.54 C. $1,000.00 D. $1,056.57 E. $1,091.59

You are paying $ 1,516.15 for a 3.0% annual coupon bond with a $1,000 face value, which matures in 30 years? Determine the yield-to-maturity (YTM). A. 1.0% B. 2.0% C. 3.0% D. 4.0% E. 5.0%

There is a 3-year bond which pays 4% annual coupons. You use a $1,000 face value and a required return rate of 2.15% p.a. in your calculations. Determine the Current Yield. A. 2.93% B. 3.80% C. 4.62% D. 5.40% E. The correct answer cannot be determined because the bond price is not provided.

What is the price of a 5.0% semi-annual coupon bond with a $1,000 face value which matures in 5 years? The yield-to-maturity (YTM) is 3.0% p.a. A. $1,070.68 B. $1,092.22 C. $1,113.76 D. $1,230.55 E. $1,255.55

In: Finance

14. The table below ~hows the probabilities of all realizations for each of the three dice....

14. The table below ~hows the probabilities of all realizations
for each of the three dice. Notice that the dice are all
"loaded" meaning that they are unbalanced in some way
leading to an unequal probability of any number coming
up.

1 2 3 4 5 6
Die 1 3.6% 30.7% 8.3% 6.1% 25.6% 25.7%
Die 2 43.0%

1.2%

17.3% 21.9% 14.5% 2.1%
Die 3 12.1% 30.2% 1.0% 18.2% 12.3% 26.2%

1. If die 3 is rolled, what is the probability of rolling a
two?
b. If one of these three dice is selected at random and
roll ed, what is the probability of rolling a two?
c. If one of these three dice is selected at random and
rolled, what number is the least likely to appear?
d. If one of these three dice is selected at random and a
two is rolled, what is the probability that die 3 was
rolled?
e. If one of these three dice is selected at random and a
four is rolled, what die is the most likely to have been
chosen?
f. If die 1 and 2 are selected and rolled, and one adds
their realizations, what is the probability that this
sum is 7?
g. If die 1 and 2 are selected and rolled, and one adds
their realizations, what is the probability that this
sum is less than S?
h. If die 1 and 2 are selected and rolled, and one adds
their realizations, what is the sum is that is more
likely to appear?
i. If die 2 and 3 are selected and rolled, and one adds
their realizations, what is the probability that this
sum is less than 11?
j. If die 1 and 3 are selected and rolled, what is the
probability that the minimum of the two realizations
is 2?
k. If die 1 and 3 are selected and rolled, what is the
probability that the minimum of the two realizations
is 5?
I. If die 1 and 3 are selected and rolled, what is the
probability that the minimum of the two realizations
is less than 4?
m. If die 2 and 3 are selected and rolled, what is the
probability that the maximum of the two realizations
is greater than 6?

In: Statistics and Probability

Which insect repellents protect best against mosquitoes? Consumer reports (June 2000) tested 14 products that all...

Which insect repellents protect best against mosquitoes? Consumer reports (June 2000) tested 14 products that all claim to be an effective mosquito repellent. Each product was classified as either lotion/cream or aerosol/spray. The cost of the product (in dollars ) was divided by the amount of the repellent needed to cover exposed areas of the skin *about 1/3 ounce) to obtain a cost-oer0use value. Effectiveness was measured as the maximum number of hours of protection (in half-hour increments) provided when human testers exposed their arms to 200 mosquitoes. The data from the report:

Insect Repellent                              Type   Cost/Use Maximum Protection
Away HourGuard 12            Lotion/Cream       $2.08      13.5 hours
Avon Skin-So-Soft       Aerosol/Spray      0.67                   0.5
Avon BugGuard Plus            Lotion/Cream       1.00                   2.0
Ben's Backyard Formula Lotion/Cream 0.75                  7.0
Bite Blocker                       Lotion/Cream         0.46                  3.0
BugOut                      Aerosol/Spray         0.11       6.0
Cutter Skinsations               Aerosol/Spray        0.22    3.0
Cutter UNscented    Aerosol/Spray     0.19               5.5
Musko1l Ultra6Hours            Aerosol/Spray     0.24                  6.5
Natrapel                         Aerosol/Spray      0.27                 1.0
Off! Deep Woods       Aerosol/Spray       1.77                  14.0
Off! Skintastic     Lotion/Cream    0.67              3.0
Sawyer Deet Formula          Lotion/Cream 0.36    7.0
Repel Permanone               Aerosol/Spray      2.75    24.0

a. Suppose you want to use repellent type to model the cost per use (y). Create the appropriate number of dummy variables for repellent type, and write the model.
b. Fit the model you wrote in part a to the data.
c. Give the null hypothesis for testing whether repellent type is a useful predictor of cost per use (y).
d. Conduct the test suggested in part c and give the appropriate conclusion. Use alpha=.10.
e. Repeat parts a-d if the dependent variable is maximum number of hours of protection (y).

In: Statistics and Probability

Six data sets are presented, some of them are samples from a normal distribution, and some...

Six data sets are presented, some of them are samples from a normal distribution, and some of them are samples from populations that are not normally distributed. Identify the samples that are not from normally distributed populations.

L1: Drug concentration six hours after administration

L2: Reading scores on standardized test for elementary children

L3: The number of minutes clerical workers took to complete a certain worksheet

L4: The level of impurities in aluminum cans (in percent)

L5: The number of defective items produced during an hour

L6: The weight of trout in ounces

L1

L2

L3

L4

L5

L6

4.7

72

4.5

2.1

21

9.9

3.2

77

5.8

1.3

16

11.3

5.1

65

3.7

2.8

10

11.4

4.7

85

4.9

1.5

10

9

3.0

68

4.3

1.0

11

10.1

3.4

83

4.7

8.2

9

8.2

4.4

73

5.8

1.9

13

8.9

3.5

79

3.2

9.5

12

9.9

4.5

72

3.0

3.2

11

10.5

5.8

81

5.1

1.3

29

8.6

3.7

79

3.6

4.4

10

7.8

4.9

91

4.3

3.8

14

10.8

5.4

69

3.6

2.7

27

8.4

3.6

67

5.4

8.0

10

9.6

4.3

82

4.7

1.9

11

9.9

3.0

66

3.0

4.9

11

8.4

5.1

77

3.4

4.5

12

9.0

4.3

66

4.3

1.5

19

9.1

Look at your modified boxplots. Which boxplot(s) show(s) outliers in the data?

Drug concentration six hours after administration

Reading scores on standardized test for elementary children

The number of minutes clerical workers took to complete a certain worksheet

The level of impurities in aluminum cans (in percent)

The number of defective items produced in an hour

The weight of trout in ounces

In: Statistics and Probability

Six data sets are presented, some of them are samples from a normal distribution, and some...

Six data sets are presented, some of them are samples from a normal distribution, and some of them are samples from populations that are not normally distributed. Identify the samples that are not from normally distributed populations.

L1: Drug concentration six hours after administration

L2: Reading scores on standardized test for elementary children

L3: The number of minutes clerical workers took to complete a certain worksheet

L4: The level of impurities in aluminum cans (in percent)

L5: The number of defective items produced during an hour

L6: The weight of trout in ounces

L1

L2

L3

L4

L5

L6

4.7

72

4.5

2.1

21

9.9

3.2

77

5.8

1.3

16

11.3

5.1

65

3.7

2.8

10

11.4

4.7

85

4.9

1.5

10

9

3.0

68

4.3

1.0

11

10.1

3.4

83

4.7

8.2

9

8.2

4.4

73

5.8

1.9

13

8.9

3.5

79

3.2

9.5

12

9.9

4.5

72

3.0

3.2

11

10.5

5.8

81

5.1

1.3

29

8.6

3.7

79

3.6

4.4

10

7.8

4.9

91

4.3

3.8

14

10.8

5.4

69

3.6

2.7

27

8.4

3.6

67

5.4

8.0

10

9.6

4.3

82

4.7

1.9

11

9.9

3.0

66

3.0

4.9

11

8.4

5.1

77

3.4

4.5

12

9.0

4.3

66

4.3

1.5

19

9.1

For which of the sample data sets is it reasonable to treat as a sample from an approximately normal population?

Drug concentration six hours after administration

Reading scores on standardized test for elementary children

The number of minutes clerical workers took to complete a certain worksheet

The level of impurities in aluminum cans (in percent)

The number of defective items produced in an hour

The weight of trout in ounces

In: Statistics and Probability

Use Excel to complete the following question. You must submit/attach all work done in Excel in...

Use Excel to complete the following question. You must submit/attach all work done in Excel

in order to receive full credit.

5. A health advocacy group conducted a study to determine if the nicotine content of a particular

brand of cigarettes was equal to the advertised amount. The cigarette brand advertised that the

average nicotine content per cigarette was 1.4 milligrams. The advocacy group randomly

sampled 24 cigarettes. The nicotine level for each of the sampled cigarettes is given below.

Nicotine mg. Nicotine mg.

1.8          1.9

1.1          1.6

1.2          1.9

1.2          1.9

1.0          2.0

2.0          1.6

1.7          1.1

2.0          1.8

2.3          1.9

1.4          1.4

0.9          1.8

2.4          1.5

a. Use Excel to obtain the sample mean and sample SD. Construct the 95 % confidence

interval. Enter the data into one, single column.

b. Provide an interpretation of the confidence interval from part A.

c. Does the obtained confidence interval contain the average nicotine level per cigarette

suggested by the cigarette maker? Explain what this means.

6. The National Heart, Lung, and Blood Institute completed a large-scale study of cholesterol and

heart disease, and reported that the national average for blood cholesterol level of 50-year old

males was 210 mg/dl. A total of 89 men with cholesterol readings in the average range (200 –

220) volunteered for a low cholesterol diet for 12 weeks. At the end of the dieting period their

average cholesterol reading was 204 mg/dl with a SD of 33 mg/dl.

a. What is the 95% confidence interval for the study described above? (submit all work)

b. Provide an interpretation of your answer to part A.

c. Does the known population mean of 210 mg/dl fall within the interval?

d. Provide an interpretation of your answer to part C.

e. How would (1) decreasing the sample size and (2) decreasing the confidence level

affect the size of the interval calculated in part A? Explain your answer.

In: Statistics and Probability

West and Jones Granite Corp uses a standard cost system for its single product. The following...

West and Jones Granite Corp uses a standard cost system for its single product. The following data are available: ACTUAL for the current year: Purchase of raw materials (5,200 sq ft at $11.80) $61,360 Raw materials used 4,800 sq ft Direct Labor costs (22,000 at $13.80) $303,600 Actual variable overhead cost $64,250 Units produced 5,820 units Standards per unit of product: Raw materials 1.0 sq ft at $10.70/sq ft Direct labor 3.8 hours at $13.50/hr Variable overhead $2.75 per direct labor hour Compute the following variances: 1. material variance (price and quantity) 2. labor variance (rate and efficiency) 3. variable overhead variance (spending and efficiency)

1- Using the attached problem, compute the material price variance.

3,750 U

5,720 U

6,600 U

10,914 F

2-

Using the attached problem, compute the material quantity variance.

3,750 U

5,720 U

6,600 U

10,914 F

3-

Using the attached problem, compute the labor rate variance.

3,750 U

5,720 U

6,600 U

10,914 F

4-

Using the attached problem, compute the labor efficiency variance.

319 F

1,566 F

3,750 U

6,600 U

5-

Using the attached problem, compute the total labor variance.

319 F

1,566 F

5,034 U

6,600 U

6-

Using the attached problem, compute the variable manufacturing overhead spending variance.

319 F

1,566 F

3,431 U

3,750 U

7-

Using the attached problem, compute the variable manufacturing overhead efficiency variance.

319 F

1,566 F

3,431 U

3,750 U

8-

Using the attached problem, compute the total variable manufacturing overhead variance.

319 F

1,566 F

3,431 U

3,750 U

In: Accounting

6.5.4 According to the WHO MONICA Project the mean blood pressure for people in China is...

6.5.4

According to the WHO MONICA Project the mean blood pressure for people in China is 128 mmHg with a standard deviation of 23 mmHg (Kuulasmaa, Hense & Tolonen, 1998). Blood pressure is normally distributed.

  1. State the random variable.
  2. Suppose a sample of size 15 is taken. State the shape of the distribution of the sample mean.
  3. Suppose a sample of size 15 is taken. State the mean of the sample mean.
  4. Suppose a sample of size 15 is taken. State the standard deviation of the sample mean.
  5. Suppose a sample of size 15 is taken. Find the probability that the sample mean blood pressure is more than 135 mmHg.
  6. Would it be unusual to find a sample mean of 15 people in China of more than 135 mmHg? Why or why not?
  7. If you did find a sample mean for 15 people in China to be more than 135 mmHg, what might you conclude?

6.5.6

The mean cholesterol levels of women age 45-59 in Ghana, Nigeria, and Seychelles is 5.1 mmol/l and the standard deviation is 1.0 mmol/l (Lawes, Hoorn, Law & Rodgers, 2004). Assume that cholesterol levels are normally distributed.

  1. State the random variable.
  2. Find the probability that a woman age 45-59 in Ghana has a cholesterol level above 6.2 mmol/l (considered a high level).
  3. Suppose doctors decide to test the woman’s cholesterol level again and average the two values. Find the probability that this woman’s mean cholesterol level for the two tests is above 6.2 mmol/l.
  4. Suppose doctors being very conservative decide to test the woman’s cholesterol level a third time and average the three values. Find the probability that this woman’s mean cholesterol level for the three tests is above 6.2 mmol/l.
  5. If the sample mean cholesterol level for this woman after three tests is above 6.2 mmol/l, what could you conclude?

In: Statistics and Probability

Smoky Mountain Corporation makes two types of hiking boots—Xtreme and the Pathfinder. Data concerning these two...

Smoky Mountain Corporation makes two types of hiking boots—Xtreme and the Pathfinder. Data concerning these two product lines appear below:   

Xtreme

Pathfinder

Selling price per unit

$

138.00

$

90.00

Direct materials per unit

$

64.40

$

51.00

Direct labor per unit

$

13.50

$

9.00

Direct labor-hours per unit

1.5

DLHs

1.0

DLHs

Estimated annual production and sales

22,000

units

73,000

units


The company has a traditional costing system in which manufacturing overhead is applied to units based on direct labor-hours. Data concerning manufacturing overhead and direct labor-hours for the upcoming year appear below:    

Estimated total manufacturing overhead

$

2,438,000

Estimated total direct labor-hours

106,000

DLHs


Required:

1. Compute the product margins for the Xtreme and the Pathfinder products under the company’s traditional costing system. (Do not round your intermediate calculations.)

Xtreme

Pathfinder

Total

Product margin

$0

2. The company is considering replacing its traditional costing system with an activity-based costing system that would assign its manufacturing overhead to the following four activity cost pools (the Other cost pool includes organization-sustaining costs and idle capacity costs):   

Estimated

Activity

Activities and Activity Measures

Overhead Cost

Xtreme

Pathfinder

Total

Supporting direct labor (direct labor-hours)

$

646,600

33,000

73,000

106,000

Batch setups (setups)

969,000

330

240

570

Product sustaining (number of products)

780,000

1

1

2

Other

42,400

NA

NA

NA

Total manufacturing overhead cost

$

2,438,000


Compute the product margins for the Xtreme and the Pathfinder products under the activity-based costing system. (Negative product margins should be indicated with a minus sign. Round your intermediate calculations to 2 decimal places.)


   

Xtreme


   

   

Pathfinder


   

   

Total


   

   

Product margin


   

   

$0


   

In: Accounting