Questions
hat does the code below do? clear vec = randi(20,1,100)-10; iter=0; k=1; while k<= length(vec) if...

hat does the code below do?

clear
vec = randi(20,1,100)-10;
iter=0;
k=1;
while k<= length(vec)
    if vec(k)<0
      vec(k)= vec(k) * -1;
    end
   k = k+1;
end

a.

This code generates a vector with 100 random integer elements between 20 and 100, and changes the sign of the elements coverting all poivitive ones to negative and all negative ones to positive.

b.

This code generates a vector with 20 random integer elements between 1 and 100, and changes the sign of all the elements.

c.

This code generates a vector with 20 random integer elements between -100 and 100, and replaces all the negative integers with a positive integer of the same absolute value.

d.

This code generates a vector with 100 random integer elements between -10 and 10, and changes the sign of all negative elements.

e.

This code generates a vector with 20 random integer elements between 1 and 100, and changes the sign of all negative elements.

In: Computer Science

LOAN COMMITMENTS. Chara&McAvoy Inc., can choose one of two projects: safe and risky. The safe project...

LOAN COMMITMENTS. Chara&McAvoy Inc., can choose one of two projects: safe and risky. The safe project yields $139 with probability .95 and zero with probability .05, whereas the risky project yields $160 with probability .60 and zero with probability .40. Each project requires an investment of $100, which Chara&McAvoy must borrow. The bank can make only an unsecured loan, and cannot observe the firm’s choice of project. Everyone is risk neutral, and the risk-free rate is zero.



Now suppose the bank has made a long-term relationship with Chara&McAvoy. The firm seeks two successive $100 loans to finance projects in periods 1 and 2. The bank promises to extend credit in period 2, at interest rate i2, on the condition that Chara&McAvoy repay its loan from period 1.


d. Given that the bank commits to lending in period 2, which rate i2 does it prefer?

e. Suppose the bank in period 2 charges its preferred rate. Given i2, find the maximum interest rate in period 1 for which Chara&McAvoy prefers the safe project.

f. What is the first period rate at which the bank breaks even on the two-period contract? Explain why this breakeven rate differs from the breakeven rate in part c.

g. Does the bank still offer the contract if it expects to incur a loss on the period 2 loan? Why?

h. Assuming the loan market is competitive, what is the equilibrium rate on the period 1 loan?

i. In this model, does the resolution of the Moral Hazard depend on the reputation of the lender or of the borrower?

j. Suppose Chara&McAvoy does not believe the bank will honor its promise to make the second loan. Since one loan is better than none, can Chara&McAvoy still enter a loan commitment with the bank?

k. If Chara&McAvoy defaults on its first loan, can the firm obtain a loan in period 2 by going to a different bank?

END.

In: Finance

Question: Rotate and sort the list:-   In this problem, you have to first implement a singly...

Question:

Rotate and sort the list:-  

In this problem, you have to first implement a singly linked list whose each node should have the following attributes,

● key - a positive integer

● next - address/pointer/reference to the next node in the linked list You will receive Q1 queries of following types,

● 1 x - Append a node to the linked list whose key should be x. After appending, print, in a new line, the key of each node in the linked list separated by a single space.

● 2 x - Delete the node in the linked list whose key is x.If such a node is not present in the linked list, no changes should be made. After this, print, in a new line, the key of each node in the linked list separated by a single space. The deleted node, if any, should be added in another linked list. Then you will receive Q2 queries of the following type,

● k - The linked list should be rotated towards right by |k| steps if k > 0, otherwise the linked list should be rotated towards left by |k| steps. k will always be an integer. Once all of the above Q2 queries are done, print, in a new line, the key of each node in the linked list separated by a single space. Then you have to merge the two linked lists together after sorting (by key), each of them using the merge sort algorithm. Once done, print in a new line, the key of each node in the linked list separated by a single space. Note that the linked list in the end should also be sorted by key.

Input Format - The first line will contain a positive integer, Q1 , following which there will be Q1 lines containing queries as described above. Then the very next line will contain a positive integer Q2 following which will be Q2 lines containing queries as described above.

Output Format - Q1 + 2 lines with space separated values of the key of each node in the linked list as explained above.

Constraints ● 0 < Q1 < 1000

● 0 < Q2 < 10000

● 0 < key, x < 1000

● -100 < k < 100

In: Computer Science

First make the changes in P82.cpp and call the new program ex82.cpp. Compile and run the...

First make the changes in P82.cpp and call the new program ex82.cpp. Compile and run the program and make sure it produces the correct results. Here is what you need to do for the exercise:

    Overload the % operator such that every time you use it, it takes two objects of type AltMoney as its arguments and returns:
            a) 5% of the difference between the income and expenditure, if income is larger than the expenditure
            b) -2% if the the expenditure is larger than the income.
            c) 0 if the expenditure is the same as income
Note that, by doing this, you are required to overload the greater than sign (>), the smaller than sign (<), and the == sign.

#include<iostream>

#include<cstdlib>

using namespace std;

class AltMoney

{

public:

       AltMoney();

       AltMoney(int d, int c);

       friend AltMoney operator +(AltMoney m1, AltMoney m2);

       void display_money();

private:

       int dollars;

       int cents;

};

void read_money(int& d, int& c);

int main()

{

       int d, c;

       AltMoney m1, m2, sum;

       sum = AltMoney(0, 0);

       read_money(d, c);

       m1 = AltMoney(d, c);

       cout << "The first money is:";

       m1.display_money();

       read_money(d, c);

       m2 = AltMoney(d, c);

       cout << "The second money is:";

       m2.display_money();

       sum = m1 + m2;

       cout << "The sum is:";

       sum.display_money();

       return 0;

      

}

AltMoney::AltMoney()

{

}

AltMoney::AltMoney(int d, int c)

{

       dollars = d;

       cents = c;

}

void AltMoney::display_money()

{

       cout << "$" << dollars << ".";

       if (cents <= 9)

             cout << "0"; //to display a 0 on the left for numbers less than 10

       cout << cents << endl;

}

AltMoney operator +(AltMoney m1, AltMoney m2)

{

       AltMoney temp;

       int extra = 0;

       temp.cents = m1.cents + m2.cents;

       if (temp.cents >= 100) {

             temp.cents = temp.cents - 100;

             extra = 1;

       }

       temp.dollars = m1.dollars + m2.dollars + extra;

       return temp;

}

void read_money(int& d, int& c)

{

       cout << "Enter dollar \n";

       cin >> d;

       cout << "Enter cents \n";

       cin >> c;

       if (d < 0 || c < 0)

       {

             cout << "Invalid dollars and cents, negative values\n";

             exit(1);

       }

}

In: Computer Science

Slope and the maximum height of a curve This problem gives you a preview of something...

Slope and the maximum height of a curve

This problem gives you a preview of something you might see in a microeconomics class. Suppose there’s an appliance store that sells air conditioners. It could set its price high and sell very few air conditioners, or it could set its price low and sell many more air conditioners. The following table shows some possible choices this store could make:

Price (Dollars per air conditioner) 400 300 200 Quantity (Air conditioners per year) Total Revenue (P x Q) (Dollars per year) C) C) 200 300 400 0,00 40,000 0,00 C) C)

The graph below plots the firm’s total revenue curve: that is, the relationship between quantity and total revenue given by the two right columns in the table above. The five choices are also labeled. Finally, two black lines are shown; these lines are tangent to the green curve at points B and D.

Using the information on the slope of the lines tangent to the curve at points B and D, plot the slope of the total revenue curve on the graph below. (As it turns out, it’s a straight line, so the two points you plot will determine a line.)

The total revenue curve reaches its maximum at a quantity of (400, 200, 100, 300)  air conditioners per year. At this point, the slope of the total revenue curve is (negative, equal to zero, positive, at its maximum, at its minimum) .

Price (Dollars per air conditioner) 400 300 200 Quantity (Air conditioners per year) Total Revenue (P x Q) (Dollars per year) C) C) 200 300 400 0,00 40,000 0,00 C) C)

In: Economics

EPS, P/E Ratio, and Dividend Ratios The Stockholders' Equity section of the balance sheet for Obregon,...

EPS, P/E Ratio, and Dividend Ratios

The Stockholders' Equity section of the balance sheet for Obregon, Inc. at the end of 2017 appears as follows:

8%, $100 par, cumulative preferred stock, 200,000 shares authorized, 50,000 shares issued and outstanding $5,000,000
Additional paid-in capital on preferred 2,500,000
Common stock, $5 par, 500,000 shares authorized, 400,000 shares issued and outstanding 2,000,000
Additional paid-in capital on common 18,000,000
Retained earnings 37,500,000
Total stockholders' equity $65,000,000

Net income for the year was $1,345,000. Dividends were declared and paid on the preferred shares during the year, and a quarterly dividend of $0.30 per share was declared and paid each quarter on the common shares. The closing market price for the common shares on December 31, 2017, was $21.15 per share.

Required:

1. Compute the following ratios for the common stock:

When required, round earnings per share and price/earnings ratio answers to two decimal places. For dividend payout and dividend yield ratios, round raw calculations to 4 decimal places, but enter each answer as a percentage to two decimal places; for example, .17856 rounds to .1786 and would be entered as 17.86, indicating 17.86%.

a. Earnings per share $?
b. Price/earnings ratio ? to 1
c. Dividend payout ratio ? %
d. Dividend yield ratio ? %

2. Before recommending the stock of Obregon to a client, as a financial adviser, you would like to know:

  1. future earnings growth.
  2. risk of the stock.
  3. general economic trends and how they affect the company.
  4. all of these.

d

In: Accounting

SoS (Sounds of Silence, Inc) prepares to launch a revolutionary system of bluetooth-enabled noise-cancellation headphones. It...

SoS (Sounds of Silence, Inc) prepares to launch a revolutionary system of bluetooth-enabled noise-cancellation headphones. It is estimated that about 800,000 consumers would be willing to pay $500 for the headphones; an additional 1,000,000 consumers would be willing to pay $250 for the headphones. Though SoS knows this marketing information, it cannot identify a consumer as belonging to one group of the other.
SoS is considering the launch of a stripped-down version of the headphones (the stripped- down version uses wires instead of bluetooth). The 800,000 high-valuation consumers would only be willing to pay $325 for the stripped-down version. The remaining 1,000,000 consumers do not particularly care about bluetooth vs. wire connections; they are willing to pay the same $250 for either version. Both the bluetooth version and the stripped-down version cost the same to produce: $100 per unit.
(3) Suppose that SoS only sells bluetooth-enabled headphones. What is the optimal price? And, what is the profit under the optimal pricing policy?
(4) Suppose that SoS sells both versions and wants to charge different prices for different ver- sions. What is the highest price of the bluetooth version for the high-valuation buyers? (Hint: Since low-valuation buyers will not have an incentive to buy the more expensive version, the highest price of the stripped-down version for the low-valuation buyers is equal to their willing- ness to pay, i.e., pL = $250)
(5) What is the total profit under the pricing strategy of question (4)?

In: Economics

1. Felicia Álvarez, a bakery manager, faces the total product curve shown, which gives the relationship...

1. Felicia Álvarez, a bakery manager, faces the total product curve shown, which gives the relationship between the number of workers she hires each day and the number of loaves of bread she produces, assuming all other factors of production are given.

Number of workers per day

Loaves of bread

per day

Marginal Product

Marginal Revenue Product

0

0

1

400

2

700

3

900

4

1,025

5

1,100

6

1,150

Assume that bakery workers in the area receive a wage of $100 per day and that the price of bread is $1.00 per loaf.

  1. Fill in the columns above for Marginal Product and Marginal Revenue Product. (one should have dollar signs and one does not!)
  2. Plot the bakery’s marginal revenue product curve on a graph.
  3. Plot the bakery’s marginal factor cost curve on the same graph (see examples of what the graph should look like in section 14.1).
  1. How many workers will Ms. Álvarez employ per day? 4
  2. Suppose that the price of bread falls to $.75 per loaf. How will this affect the marginal revenue product curve for workers at the firm? Plot the new curve, label it MRP2.

  1. How will the shift in MRP affect the number of workers Ms. Álvarez hires?

  1. Suppose the price of bread rises to $1.50 per loaf. How will this affect the marginal revenue product curve for workers? Plot the new curve, label it MRP3.
  1. How will the shift in MRP affect the number of workers that Ms. Álvarez hires?

In: Economics

The following data show the brand, price ($), and the overall score for six stereo headphones...

The following data show the brand, price ($), and the overall score for six stereo headphones that were tested by a certain magazine. The overall score is based on sound quality and effectiveness of ambient noise reduction. Scores range from 0 (lowest) to 100 (highest). The estimated regression equation for these data is

ŷ = 23.462 + 0.315x,

where x = price ($) and y = overall score.

Brand Price ($) Score
A 180 74
B 150 73
C 95 59
D 70 58
E 70 42
F 35 24

(a)

Compute SST, SSR, and SSE. (Round your answers to three decimal places.)

SST=

SSR=

SSE=

(b)

Compute the coefficient of determination r2.

(Round your answer to three decimal places.)

r2

=

Comment on the goodness of fit. (For purposes of this exercise, consider a proportion large if it is at least 0.55.)

The least squares line provided a good fit as a small proportion of the variability in y has been explained by the least squares line.

The least squares line provided a good fit as a large proportion of the variability in y has been explained by the least squares line.    

The least squares line did not provide a good fit as a large proportion of the variability in y has been explained by the least squares line.

The least squares line did not provide a good fit as a small proportion of the variability in y has been explained by the least squares line.

(c)

What is the value of the sample correlation coefficient? (Round your answer to three decimal places.)

In: Statistics and Probability

1. In 1995, the Food and Drug Administration (FDA) published new labeling standards for bottled water....

1. In 1995, the Food and Drug Administration (FDA) published new labeling standards for bottled water. (The full text of the final rule can be found at http://cfr.vlex.com/vid/165-110-bottled-water-19705533.) Prior to that time, bottlers could sell regular tap water under a bottled water label. In fact, the FDA estimated that approximately 25 percent of the supply of bottled water was nothing more than ordinary tap water.

(a) Consider how these tougher standards eliminated 25 percent of the supply of bottled water. If market demand is unaffected, what qualitative impact would this labeling change have on equilibrium price and quantity for bottled water? Support your answer with a graphical model.

(b) Let the market demand and market supply equations are QD = −100P+ 1, 150 and QS = 400P − 100. How much of bottled water would be supplied in a static efficient allocation and at what price?

Now, suppose the change in standards results in a new market supply of QS new = 400P − 350 with no change in market demand.

(c) Determine the new static efficient allocation for bottled water and new market price. Do your results agree with your intuitive answer to part (a)? (d) Graphically illustrate the market for bottled water before and after the change in labeling standards. Be sure to label all relevant points.

(e) Compare the values of consumer surplus and producer surplus before and after the change in labeling standards. Is this result expected? Why or why not?

In: Economics