For this assignment, write a program that will generate three randomly sized sets of random numbers using DEV C++
To use the random number generator, first add a #include statement for the cstdlib library to the top of the program:
#include <cstdlib>
Next, initialize the random number generator. This is done by calling the srand function and passing in an integer value (known as a seed value). This should only be done ONE time and it MUST be done before actually getting a random number. A value of 1 (or any integer literal) will generate the same sequence of "random" numbers every time the program is executed. This can be useful for debugging:
srand(1);
To get a different series of random numbers each time the program is run, the actual time that the program is run can be passed as the seed value for the random number generator. This is done as follows:
srand(time(0));
If the time function is used, make sure to include the ctime library as well.
Note: the two srand instructions that are listed above are simple examples of how to use the instruction. In a program, only one version will be used.
Now that the random number generator has been initialized, a random number can be generated by calling the rand function:
num = rand();
The above line of C++ code will generate a "random" integer between 0 and RAND_MAX and saves the value in an integer variable named num. RAND_MAX is a pre-defined constant that is equal to the maximum possible random number. It is implementation dependent but is guaranteed to be at least 32,767.
Modulus division can be used to restrict the "random" integer to a smaller range:
num = rand() % 7;
will produce a value between 0 and 6. To change the range to 1 through 7, simply add 1:
num = rand() % 7 + 1;
To get random values that are within a specified range that starts at a value other than 0 or 1:
num = minimum_value + (rand() % (maximum_value - minimum_value + 1));
So, to get values within the range 3 - 17:
num = 3 + (rand() % (17 - 3 + 1));
Run 1 (using srand(5);) on Windows PC
There are 59 numbers in the first set of numbers. 93 55 49 60 30 27 49 72 40 14 21 33 76 26 7 63 7 50 31 17 92 93 11 36 49 52 83 22 31 51 69 59 10 53 15 22 87 83 34 86 6 54 85 15 19 60 15 46 12 84 5 91 59 33 99 70 4 17 36 There are 235 numbers in the second set of numbers. 66 38 1 36 10 89 90 93 51 6 35 50 68 46 82 75 35 82 60 53 40 9 53 85 90 16 39 93 63 85 86 84 17 58 78 60 19 67 85 0 26 71 80 74 78 85 43 73 33 29 39 56 61 75 92 83 55 86 19 66 70 86 21 75 46 58 72 2 51 47 82 16 17 91 16 68 41 25 9 86 51 33 67 89 61 46 73 82 24 91 49 43 54 27 32 72 76 96 16 97 97 5 73 27 58 86 52 68 7 68 59 61 98 2 25 86 75 16 93 89 32 82 68 74 21 71 20 67 94 58 30 70 0 72 24 95 86 8 87 36 77 71 14 26 46 8 76 2 50 55 19 24 46 16 34 71 33 71 60 25 58 5 93 11 86 34 72 32 33 80 42 30 0 10 38 58 67 98 45 26 24 24 28 84 36 17 0 4 60 95 69 60 55 69 42 40 26 93 32 53 0 28 64 74 75 17 30 72 30 54 48 37 8 39 4 44 65 81 5 43 28 98 67 63 69 14 68 63 80 73 89 58 17 82 22 There are 205 numbers in the third set of values. 81 40 35 33 69 58 56 79 66 0 2 24 65 35 50 84 7 26 85 35 88 75 24 58 16 20 38 23 18 7 44 52 16 82 36 47 22 31 30 21 78 59 54 88 0 17 90 81 87 73 59 58 60 94 49 92 22 29 81 1 97 39 49 71 59 32 90 36 55 33 25 97 40 23 34 81 66 29 38 88 35 88 2 55 5 45 44 94 34 83 26 91 16 85 10 64 1 66 28 96 66 87 18 34 60 53 83 90 23 12 65 84 71 75 98 31 35 5 29 22 72 51 22 37 38 51 62 26 56 12 23 1 22 27 76 85 34 61 92 48 68 42 32 78 95 54 6 32 67 26 51 62 36 25 93 59 54 51 25 45 15 54 55 73 19 51 24 36 2 79 19 97 23 66 91 5 91 1 27 20 47 55 15 62 42 13 70 94 58 98 17 6 18 23 75 11 52 28 45 30 89 95 32 95 49
In: Computer Science
Question No.4: {10marks}
In: Economics
The following demand (Q D) function has been
estimated for Fantasy pinball machines:
Q D = 3,500 − 40P + 17.5P x + 670U + .0090A +
6,500N
where P = monthly rental price of Fantasy pinball machines
P
x = monthly rental price of Old Chicago pinball machines
(their largest competitor)
U
= current unemployment rate in the 10 largest metropolitan
areas
A
= advertising expenditures for Fantasy pinball machines
N
= fraction of the U.S. population between ages 10 and 30
(a) The point price
elasticity of demand (E D) for Fantasy pinball machines
when P = $150, P x = $100, U = .12, A = $200,000 and N =
.35 is . (round to the second digit after the decimal)
{Hint: When you compute Q D using the provided
information, round to the first digit after the decimal.}
(b) The point cross
elasticity of demand with respect to Old Chicago pinball machines
for the values of the independent variables given in part (a)
is . (round to the second digit after the decimal)
In: Economics
Donaldsen International is an all-equity firm with a current share price of $12.50 and 10,000 shares outstanding. Management is considering issuing $50,000 of debt at an interest rate of 6.5 percent and using the proceeds to repurchase shares. It is felt that the company will have earnings before interest and taxes (EBIT) of $30,000. The company tax rate is 30%. What will the earnings per share (EPS) be if the debt is issued?
You are comparing two financial policies. The first is all equity. The second involves the use of $2 million of debt. The break-even point between these two policies occurs when the earnings before interest and taxes (EBIT) is $450,000. Given this, it is accurate to say that leverage _____ beneficial to the firm when EBIT is $325,000 and _____ beneficial when EBIT is $625,000.
A company has 400,000 shares outstanding at a market price of $6 each. The company also has 20,000 bonds outstanding each with a face value of $100, and a market price of $113.
What is the firm's equity ratio?
In: Finance
Question 1: CVP relation
| Sales volume in units | 100 |
| Revenue | $7,000 |
| Variable costs | $4,000 |
| Contribution margin | $3,000 |
| Fixed costs | $1,800 |
| Profit | $1,200 |
a) Compute the following items:
price=
unit VC=
unit CM=
b) Write down the CVP relation.
Profit = ___________ * volume -
__________
(e.g., if Profit=4*volume-1000, enter 4 in the first box and 1000
in the second box).
c) Predict profit at sales volume of 120
units:
d) Your boss gave you a profit target of $2,100. How many
units do you need to sell to meet this target?
e) Compute the breakeven point:
breakeven volume =
breakeven revenue =
f) Compute the margin of safety at current sales volume of
100 units:
(e.g., if your answer is 20%, enter 20 without the % sign)
If sales decrease by 35%, will you lose money? YES
/ NO
If sales decrease by 45%, will you lose money? YES
/ NO
g) When sales volume increases by 10 units (from any
initial level in the relevant range), profit increases
by:
price*10 = $700
unit VC*10 = $400
not enough informationunit
CM*10 = $300
In: Accounting
The following table depicts the market supply and demand for Video Game Players.
Suppose demand can be described with the equation Q = 900 – 5P and supply with the equation Q = 100 + 5P. Complete the following table.
Determine the equilibrium price and quantity.
Determine the surplus or shortage if the price were $90.
| Price | Quantity Demanded | Quantity Supplied | Surplus/ Shortage | Amount of Surplus or Shortage |
| $100 | ||||
| $95 | ||||
| $90 | ||||
| $85 | ||||
| $80 | ||||
| $75 | ||||
| $70 | ||||
| $65 | ||||
| $60 |
In: Economics
Question 1-- NPV Profiles: Graph the NPV profiles for both projects on a common chart., making sure you identify the "crucial" points.
Time Project A Cash flow Project B Cash flow
0 -$725 -$850
1 100 200
2 250 200
3 250 200
4 200 200
5 100 200
6 100 200
7 100 200
Note: First column is time, second column is Project A, third column is Project B.
This is a two-part question. Answer for first ? is needed to solve ? 2.
Question 2-- IRR Applicability:For what range of possible interest rates would you want to use IRR to choose between the those to projects? For what range would you NOT want to use IRR?
In: Finance
Question 1-- NPV Profiles: Graph the NPV profiles for both projects on a common chart., making sure you identify the "crucial" points.
0 -$725 -$850
1 100 200
2 250 200
3 250 200
4 200 200
5 100 200
6 100 200
7 100 200
Note: First column is time, second column is Project A cash flow , third column is Project B flow. This is a two-part question. Answer for first ? is needed to solve ? 2.
Question 2-- IRR Applicability:For what range of possible interest rates would you want to use IRR to choose between the those to projects? For what range would you NOT want to use IRR?
In: Finance
The price of a stock (S0) is $75. A trader sells 6 (N) put
option contracts (each contract of 100) on the stock with a strike
price (K) of $78 when the option price (c) is $5. The options are
exercised when the stock price (S1) is $74. What is the trader’s
net profit or loss?
Solve in following 4 steps.
a) Option profit = K – S0
___________________________________________________
b) Trader’s gain per option = c – (K – S0)
____________________________________
c) Total options sold = N x 100
_____________________________________________
d) Trader’s total gain = b x c
_________________________________________________
In: Finance
Exchange Rate Pass-through: I have read about a study by Gopinath, Itskhoki, and Rigobon (2010) about the currency which importers decide to price their goods in. The study suggests that if an importer wants low passthrough rate (e.g. 0-20%), it will price in USD. If an importer wants high passthrough rate (e.g. 100%), it will price in non-Dollar curencies. Can someone explain why an importer would want 100% passthrough versus 0% passthrough? How does this impact an importer choosing to price in local currency versus the foreign currency?
In: Economics