Questions
Python Knapsack Problem: Acme Super Store is having a contest to give away shopping sprees to...

Python Knapsack Problem:

Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family wins a shopping spree each person in the family can take any items in the store that he or she can carry out, however each person can only take one of each type of item. For example, one family member can take one television, one watch and one toaster, while another family member can take one television, one camera and one pair of shoes.

Each item has a price (in dollars) and a weight (in pounds) and each person in the family has a limit in the total weight they can carry. Two people cannot work together to carry an item. Your job is to help the families select items for each person to carry to maximize the total price of all items the family takes. Write an algorithm to determine the maximum total price of items for each family and the items that each family member should select.

***In python:***

Implement your algorithm by writing a program named “shopping.py”. The program should satisfy the specifications below.

Input: The input file named “shopping.txt” consists of T test cases

T (1 ≤ T ≤ 100) is given on the first line of the input file.

Each test case begins with a line containing a single integer number N that indicates the number of items (1 ≤ N ≤ 100) in that test case

Followed by N lines, each containing two integers: P and W. The first integer (1 ≤ P ≤ 5000) corresponds to the price of object and the second integer (1 ≤ W ≤ 100) corresponds to the weight of object.

The next line contains one integer (1 ≤ F ≤ 30) which is the number of people in that family.

The next F lines contains the maximum weight (1 ≤ M ≤ 200) that can be carried by the ith person in the family (1 ≤ i ≤ F).

Output: Written to a file named “results.txt”. For each test case your program should output the maximum total price of all goods that the family can carry out during their shopping spree and for each the family member, numbered 1 ≤ i ≤ F, list the item numbers 1 ≤ N ≤ 100 that they should select.

Sample Input from input file

2

3

72 17

44 23

31 24

1

26

6

64 26

85 22

52 4

99 18

39 13

54 9

4

23

20

20

36

Sample Output:

Test Case 1

Total Price 72

Member Items

1: 1

Test Case 2

Total Price 568

Member Items

1: 3 4

2: 3 6

3: 3 6

4: 3 4 6

In: Computer Science

A small insurance company, is trying to decide how much money to keep in liquid asset...

A small insurance company, is trying to decide how much money to keep in liquid asset to cover auto insurance claims. The company holds some of the premiums it receives in interest bearing checking accounts and puts the rest into investments that are not quite as liquid, but generate a higher return. The company wants to study cash flows to determine how much money it should keep in liquid assets to pay claims. A review of the company’s data has shown the following: Repair bills per claim have a Normal distribution with a mean of $3000 and a standard deviation of $1000. The number of repair claims filed each week is distributed as follows:

No. of repair claims 1 2 3 4 5 6 7 8 9

Probability (respective to no. of repair claims): 0.05 0.06 0.10 0.17 0.28 0.14 0.08 0.07 0.05

In addition to repair claims, the company also receives claims for cars that have been “totaled”, that is, damaged beyond repair. On average, there is a 20% chance of occurrence of this type of claim in any week. Typically, these claims cost anywhere from $3000 to $35000, the most common cost being around $18000. Suppose that the company decides to keep $35000 cash on hand to pay claims.

What is the probability that this amount would not be adequate to cover claims in any week? Please illustrate on excel.

In: Statistics and Probability

An army tank 3.9 m wide needs to travel 47 m to cross a minefield. The...

An army tank 3.9 m wide needs to travel 47 m to cross a minefield. The enemy that laid the minefield is known to have a standard practice of randomly
placing 160 mines per hectare (10 000 m2). The tank will set off any mine that it passes over. If the tank sets off a single mine then the armour protecting
the engine will crack, but the engine will keep working. However, setting off a second mine will damage the engine and stop the tank in its tracks. What is
the probability that the tank will make it to the other side of the minefield? (Answer to 2 decimal places)
____________
Assume that the tank makes it to the other side. What is the probability that the armour protecting the engine will not have been cracked? (Answer to 2
decimal places)
____________
Assume that there is another minefield with the same density of mines that is wide enough that it is unlikely that a tank will be able to get to the other side
without being stopped. A large number of tanks line up side by side and start crossing this minefield. What do you expect the median distance travelled by
the tanks to be. (Answer to 2 decimal places)*
____________
*Note: Less tanks would be blown up if they followed one another, as the first tank would explode the mines and the following tanks would have a clear
path. This is not happening in this question because the commander is worried that it is easier for the enemy to shoot tanks when they all follow the same
line.

In: Statistics and Probability

The firm Ragnar has announced an initial public offering of shares (IPO). The shares are being...

The firm Ragnar has announced an initial public offering of shares (IPO). The shares are being offered in the IPO at a price of $6 each. All potential investors know that at this price the share is either undervalued by $0.50 (probability 60%) or overvalued by $0.30 (probability 40%). ‘Informed’ investors such as banks are able to distinguish whether the share is overvalued or undervalued. ‘Uninformed’ investors are not able to do this. Demand from uninformed investors is sufficient to take up all the shares offered in the IPO. If the demand for the shares is greater than the number offered, the shares will be rationed. You are an uninformed investor with $12,000 to invest. If rationing occurs you will only be able to buy 800 of Ragnar’s IPO shares.

(a) By what percentage is the IPO underpriced/overpriced?

(b) What would be your expected profit if you were able to buy 2,000 of the IPO shares? Do you expect to be able to do this? Why/why not?

(c) As an uninformed investor, what is your expected profit from participating in the IPO?

(d) What would your expected profit be if the undervaluation is only $0.20 per share instead of $0.50, and everything else unchanged? What is the underpricing percentage now?

(e) Explain what is meant by the ‘winner’s curse’ in the context of IPOs, with reference to your answers for the previous parts of the question. Briefly discuss one other possible reason for the empirically observed underpricing of IPOs. (140 words)

In: Accounting

The firm Ragnar has announced an initial public offering of shares (IPO). The shares are being...

The firm Ragnar has announced an initial public offering of shares (IPO). The shares are being offered in the IPO at a price of $6 each. All potential investors know that at this price the share is either undervalued by $0.50 (probability 60%) or overvalued by $0.30 (probability 40%).

‘Informed’ investors such as banks are able to distinguish whether the share is overvalued or undervalued. ‘Uninformed’ investors are not able to do this. Demand from uninformed investors is sufficient to take up all the shares offered in the IPO.
If the demand for the shares is greater than the number offered, the shares will be rationed.

You are an uninformed investor with $12,000 to invest. If rationing occurs you will only be able to buy 800 of Ragnar’s IPO shares.

(a) By what percentage is the IPO underpriced/overpriced?

(b) What would be your expected profit if you were able to buy 2,000 of the IPO shares? Do you expect to be able to do this? Why/why not?

(c) As an uninformed investor, what is your expected profit from participating in the IPO?

(d) What would your expected profit be if the undervaluation is only $0.20 per share instead of $0.50, and everything else unchanged? What is the underpricing percentage now?

(e) Explain what is meant by the ‘winner’s curse’ in the context of IPOs, with reference to your answers for the previous parts of the question. Briefly discuss one other possible reason for the empirically observed underpricing of IPOs.

In: Accounting

The firm Ragnar has announced an initial public offering of shares (IPO). The shares are being...

The firm Ragnar has announced an initial public offering of shares (IPO). The shares are being offered in the IPO at a price of $6 each. All potential investors know that at this price the share is either undervalued by $0.50 (probability 60%) or overvalued by $0.30 (probability 40%). ‘Informed’ investors such as banks are able to distinguish whether the share is overvalued or undervalued. ‘Uninformed’ investors are not able to do this. Demand from uninformed investors is sufficient to take up all the shares offered in the IPO. If the demand for the shares is greater than the number offered, the shares will be rationed. You are an uninformed investor with $12,000 to invest. If rationing occurs you will only be able to buy 800 of Ragnar’s IPO shares.

(a) By what percentage is the IPO underpriced/overpriced?

(b) What would be your expected profit if you were able to buy 2,000 of the IPO shares? Do you expect to be able to do this? Why/why not?

(c) As an uninformed investor, what is your expected profit from participating in the IPO?

(d) What would your expected profit be if the undervaluation is only $0.20 per share instead of $0.50, and everything else unchanged? What is the underpricing percentage now?

(e) Explain what is meant by the ‘winner’s curse’ in the context of IPOs, with reference to your answers for the previous parts of the question. Briefly discuss one other possible reason for the empirically observed underpricing of IPOs. (140 words)

In: Accounting

High school seniors with strong academic records apply to the nation's most selective colleges in greater...

High school seniors with strong academic records apply to the nation's most selective colleges in greater numbers each year. Because the number of slots remains relatively stable, some colleges reject more early applicants. Suppose that for a recent admissions class, an Ivy League college received 2851 applications for early admission. Of this group, it admitted 1033 students early, rejected 854 outright, and deferred 964 to the regular admission pool for further consideration. In the past, this school has admitted 18% of the deferred early admisiion applicants during the regular admission process. Counting the students admitted early and the students admitted during the regular admission process, the total class size was 2375. Let E, R, and D represent the events that a student who applies for early admissions is admitted early, rejected outright, or deferred to the regular admissions pool. A) Use data to estimate P(E), P(R), and P(D). B) Are events E and D mutually exclusive? Find P(EUD). C) For the 2375 students who were admitted, what is the probability that a randomly selected student was accepted during early admission? D) SUppose a student applies for early admission. What is the probability that the students will be admitted for early admission or be deferred and later admitted during the regular admission process?

In: Statistics and Probability

On Tuesday, Sara’s Produce is expecting to receive Package A containing $2,000 worth of food. Based...

On Tuesday, Sara’s Produce is expecting to receive Package A containing $2,000 worth of food. Based on the past experience with the delivery service, the owner estimates that this package has a chance of 10% being lost in shipment.

On Wednesday, Sara’s Produce expects Package B to be delivered. Package B contains $1,000 worth of food. This package has a 4% chance of being lost in shipment.

a.Construct [in table form] the probability distribution for total dollar amount of losses for package A and B.

In the table, make sure you specify:

1)The possible outcomes for Sara’s total dollar amount of losses for package A and B.Please note that this asks about total dollar amount of losses, not number of losses.

2)For each dollar amount of losses, describe under what circumstances it would occur. In other words, what event(s) must happen for each dollar amount of losses to occur?

3)For each of the possible outcomes you identify in part [a], derive the probability of the outcome occurring.

b.Calculate the expected value of total dollar amount of losses.

c.The owner has calculated the variance for the total dollar amount of losses to be 398,400. Since you want to be sure you are using correct numbers in your evaluation, prove that the owner calculated the correct variance for total dollar amount of losses. Show all work!

In: Statistics and Probability

You are currently a worker earning $60,000 per year but are considering becoming an entrepreneur. You...

You are currently a worker earning $60,000 per year but are considering becoming an entrepreneur. You will not switch unless you earn an accounting profit that is on average at least as great as your current salary. You look into opening a small grocery store. Suppose that the store has annual costs of $160,000 for labor, $50,000 for rent, and $30,000 for equipment. There is a one-half probability that revenues will be $210,000 and a one-half probability that revenues will be $400,000.

Instructions: For all parts, enter a loss as a negative number. If you are entering any negative numbers be sure to include a negative sign (-) in front of those numbers.

a. In the low-revenue situation, what will your accounting profit or loss be?

In the high-revenue situation, what will your accounting profit or loss be?

b. On average, how much do you expect your revenue to be?

Your accounting profit?

Your economic profit?

Will you quit your job and try your hand at being an entrepreneur?

   (Click to select)  No  Yes

c. Suppose the government imposes a 25 percent tax on accounting profits. This tax is only levied if a firm is earning positive accounting profits. What will your after-tax accounting profit be in the low-revenue case?

In the high-revenue case?

What will your average after-tax accounting profit be?

What about your average after-tax economic profit?

Will you now want to quit your job and try your hand at being an entrepreneur?

In: Economics

Allen's hummingbird (Selasphorus sasin) has been studied by zoologist Bill Alther.† Suppose a small group of...

Allen's hummingbird (Selasphorus sasin) has been studied by zoologist Bill Alther.† Suppose a small group of 16 Allen's hummingbirds has been under study in Arizona. The average weight for these birds is x = 3.15 grams. Based on previous studies, we can assume that the weights of Allen's hummingbirds have a normal distribution, with σ = 0.26 gram.

(a) Find an 80% confidence interval for the average weights of Allen's hummingbirds in the study region. What is the margin of error? (Round your answers to two decimal places.)

lower limit    
upper limit    
margin of error    


(b) What conditions are necessary for your calculations? (Select all that apply.)

σ is unknown

normal distribution of weight

suniform distribution of weights

σ is knownn is large



(c) Interpret your results in the context of this problem.

We are 20% confident that the true average weight of Allen's hummingbirds falls within this interval.

The probability that this interval contains the true average weight of Allen's hummingbirds is 0.80.     

The probability that this interval contains the true average weight of Allen's hummingbirds is 0.20.

We are 80% confident that the true average weight of Allen's hummingbirds falls within this interval.


(d) Find the sample size necessary for an 80% confidence level with a maximal margin of error  E = 0.14 for the mean weights of the hummingbirds. (Round up to the nearest whole number.)
hummingbirds

In: Statistics and Probability