Questions
use a match almost once. consider rhe following instance variable and method. private int[]arr; puplic int...

use a match almost once.
consider rhe following instance variable and method.
private int[]arr;
puplic int i(intx){
   \\PRECOND
   for (intk =arr.length-1;k>=0;k--){
   \\LOOPINVAR
   is(arr[k]<x)returnk;
   }
   \\POSTCOND
   RETURN-1;
}
Let:int m=f(n)

                                       1.assert(a!=null);
                                       2.assert(a.length>0);
                                       3.assert(true)
                                       4.assert(false);
                                       5. All values in positions 0 through m are less than n.
                                       6. All values in positions m+1 through arr.lenght-1 are greater than or equal to n.
                                       7.All the values in positions m+1 through arr.lenght-1 are less then n.
                                       8.The smallest value is at position m.
                                       9.The largest value that is smaller that n is at position m.
                                       10.All values in positions k+1 through arr.length-1 are greater than or equal to n.
                                       11.All values in positions k though arr.length-1 are less than n.
                                       12.all values in positions 0 through k are less than n
                                       13.int[] arr={3,9,3,5,8}
                                       assertTrue(f(4)==2);
                                       14.int[] arr={1,9,3,5,8}
                                       assertTrue(f(4)==0);
The best Preconditions is ____
junit test for thr method that fails____
Best postondition____
junit test for the method that passes_____
Loop invariant_____

In: Computer Science

Capital Rationing Decision Involving Four Proposals Kopecky Industries Inc. is considering allocating a limited amount of...

Capital Rationing Decision Involving Four Proposals

Kopecky Industries Inc. is considering allocating a limited amount of capital investment funds among four proposals. The amount of proposed investment, estimated income from operations, and net cash flow for each proposal are as follows:


Investment

Year
Income from
Operations
Net Cash
Flows
Proposal Sierra: $850,000 1 $ 80,000 $ 250,000
2 80,000 250,000
3 80,000 250,000
4 30,000 200,000
5 (70,000) 100,000
$200,000 $ 1,050,000
Proposal Tango: $1,200,000 1 $320,000 $ 560,000
2 320,000 540,000
3 160,000 400,000
4 60,000 300,000
5 (40,000) 220,000
$820,000 $2,020,000
Proposal Uniform: $550,000 1 $ 90,000 $ 200,000
2 90,000 200,000
3 90,000 200,000
4 90,000 200,000
5 70,000 180,000
$430,000 $ 980,000
Proposal Victor: $380,000 1 $44,000 $ 120,000
2 44,000 120,000
3 44,000 120,000
4 4,000 80,000
5 4,000 80,000
$140,000 $ 520,000

The company's capital rationing policy requires a maximum cash payback period of three years. In addition, a minimum average rate of return of 12% is required on all projects. If the preceding standards are met, the net present value method and present value indexes are used to rank the remaining proposals.

Present Value of $1 at Compound Interest
Year 6% 10% 12% 15% 20%
1 0.943 0.909 0.893 0.870 0.833
2 0.890 0.826 0.797 0.756 0.694
3 0.840 0.751 0.712 0.658 0.579
4 0.792 0.683 0.636 0.572 0.482
5 0.747 0.621 0.567 0.497 0.402
6 0.705 0.564 0.507 0.432 0.335
7 0.665 0.513 0.452 0.376 0.279
8 0.627 0.467 0.404 0.327 0.233
9 0.592 0.424 0.361 0.284 0.194
10 0.558 0.386 0.322 0.247 0.162

Required:

1. Giving effect to straight-line depreciation on the investments and assuming no estimated residual value, compute the average rate of return for each of the four proposals. Round to one decimal place.

Average Rate of Return
Proposal Sierra %
Proposal Tango %
Proposal Uniform %
Proposal Victor %

2. For the proposals accepted for further analysis in part (3), compute the net present value. Use a rate of 12% and the present value of $1 table above. If required, use the minus sign to indicate a negative net present value.

Select the proposal accepted for further analysis. Proposal Tango Proposal Uniform
Present value of net cash flow total $ $
Amount to be invested
Net present value $ $

3. Compute the present value index for each of the proposals in part (4). Round to two decimal places.

Select the proposal to compute present value index. Proposal Tango Proposal Uniform
Present value index (rounded)

In: Finance

Exercise 13 : For this exercise replace A with 4. Consider the following demand function: x...

Exercise 13 :

For this exercise replace A with 4. Consider the following demand function:

x ∗1 ( p 1 , p 2 , m ) = A + 2 , p1 (A+m+1)

for values of m > 1.
a. Obtain Income elasticity of demand. Plot the Engel curve for p1 = 1.
b. Is this a normal good?
c. Assuming that preferences are monotonic (then the individual always

spends all its income), use the budget constraint to solve for x∗2 (p1,p2,m). d. The consumer faces the following prices and income level:

prices p1 =1, p2 =1.5 andincome m=5.

Calculate the quantity demanded for goods 1 and 2 at these prices and this income level.

e. Obtain income and substitution effects with Slutsky compensation when the price of good 1 drops to p, =1−A+6

Need help with letter e

In: Economics

A. Write a C++ with a menu (using switch) that asks the user to select one...

A. Write a C++ with a menu (using switch) that asks the user to select one of the following choices to the user:

1. Options ‘S’ or ‘s’

2. Option ‘T’ or ‘t

3. Options ‘P’ or ‘p’

4. print in the Matrix format

B. When 1 is selected, prompt the user to enter the starting value st (int value). Use a single FOR loop to count numbers from 1 to st. When the loop is finished, find the average of those numbers.

C. When 2 is selected, prompt the user for a number num (int). Use a single WHILE loop to calculate the sum of the odd numbers between 1 and num.

D. When 3 is selected. Use a single DO-WHILE loop to promt the user to enter random (int) values and stop whenver the first negative value is entered. Then tell the user how many positive value has been entered.

E. When 4 is selected. Use NESTED FOR loops to output all the even numbers from 1 to 80 in 5 rows and 8 columns.

NB. If the user does not select one of these 4 options print " invalid selection".

In: Computer Science

The following information applies to the next 6 questions. Suppose that the stripped U.S. Treasury bonds...

The following information applies to the next 6 questions.

Suppose that the stripped U.S. Treasury bonds were priced as follows in Jan 2015:

Maturity (years)

Price

1

96.1538

2

90.7029

3

83.9619

What is the estimated 1-year spot interest rate for Treasury securities?

What is the estimated 2-year spot interest rate for Treasury securities?

3%

4%

5%

6%

7%

What is the estimated 3-year spot interest rate for Treasury securities?

3%

4%

5%

6%

7%

What is the estimated forward interest rate for the 1-year period starting 1/1/2016?

3%

4%

5%

6%

7%

Suppose there is a 3-year 10% coupon T-bond with annual coupon payment.  Based on the above stripped U.S. Treasury bond prices, what should be the price of the 10% coupon bond if there is to be no arbitrage opportunities. Assume the par value is $1,000.

1,036.53

1,041.33

1,052.27

1,065.17

1,110.44

QUESTION 81

  1. What is the yield to maturity of the above 3-year 10% T-bond?

    4.87%

    5.88%

    6.33%

    6.57%

    7.78%

In: Finance

Consider polynomial interpolation of the function f(x)=1/(1+25x^2) on the interval [-1,1] by (1) an interpolating polynomial...

Consider polynomial interpolation of the function f(x)=1/(1+25x^2) on the interval [-1,1] by (1) an interpolating polynomial determined by m equidistant interpolation points, (2) an interpolating polynomial determined by interpolation at the m zeros of the Chebyshev polynomial T_m(x), and (3) by interpolating by cubic splines instead of by a polynomial. Estimate the approximation error by evaluation max_i |f(z_i)-p(z_i)| for many points z_i on [-1,1]. For instance, you could use 10m points z_i. The cubic spline interpolant can be determined in MATLAB; see "help spline". Use m=10 and m=20. Compute splines that interpolate at equidistant nodes and at Chebyshev nodes. Provide tables of the errors and plots of the function f and the interpolating polynomials and splines.

In: Advanced Math

Fibonacci Sequence: F(0) = 1, F(1) = 2, F(n) = F(n − 1) + F(n −...

Fibonacci Sequence:

F(0) = 1, F(1) = 2, F(n) = F(n − 1) + F(n − 2) for n ≥ 2


(a) Use strong induction to show that F(n) ≤ 2^n for all n ≥ 0.


(b) The answer for (a) shows that F(n) is O(2^n). If we could also show that F(n) is Ω(2^n), that would mean that F(n) is Θ(2^n), and our order of growth would be F(n). This doesn’t turn out to be the case because F(n) is not Ω(2^n), and thus not Θ(2^n). But it is true that F(n) ≥ (3/2)^n for all n ≥ 0. Use induction (or strong induction) to prove this.

In: Computer Science

using power series of 1/(1-x), a) derive the power series for 1/(9+x^2) and determine the radius...

using power series of 1/(1-x),

a) derive the power series for 1/(9+x^2) and determine the radius of convergence of this power series

b) use the result from (a) to derive the power series for tan^-1(x) and state the radius of convergence of this power series

In: Advanced Math

1- Show that (n^3+3n^2+3n+1) / (n+1) is O (n2 ). Use the definition and proof of...

1- Show that (n^3+3n^2+3n+1) / (n+1) is O (n2 ). Use the definition and proof of big-O notation.

2- Prove using the definition of Omega notation that either 8 n is Ω (5 n ) or not.

please help be with both

In: Computer Science

Garden Lili inherited her grandfather’s land and wanted to start gardening. Lili’s garden size is X...

Garden

Lili inherited her grandfather’s land and wanted to start gardening. Lili’s garden size is X × Y with various types of plants marked with integer c.

Given a two-dimensional array that contains the type of plant in the garden. Lily wants to make T changes to the garden. For each change made, Lili will plant c in the a-th row of the b-th column of the array. The row and column starts from number 1.

Format Input:

The input consists of integers X and Y followed by an array of X × Y , then contains an integer T which is the number of changes made by Lili. The next T line contains three numbers a, b, c which contains the array location index you want to change to the integer c.

Format Output:

The output contains a two dimensional array in the form of a Lili garden plan after a change is made.

Constraints

1 ≤ a, b, c, X, Y ≤ 100

1 ≤ T ≤ 1000

Sample Input 1 (standard input):

3 3

1 1 1

1 1 1

1 1 1

3

1 1 3

2 2 3

3 3 3

Sample Output 1 (standard output):

3 1 1

1 3 1

1 1 3

Sample Input 2 (standard input):

5 3

1 2 3

4 5 6

7 8 9

10 11 12

13 14 15

3

1 1 16

1 2 17

1 3 18

Sample Output 2 (standard output):

16 17 18

4 5 6

7 8 9

10 11 12

13 14 15

note : USE C language, integer must be the same as the constraint, DONT USE VOID, RECURSIVE(RETURN FUNCTION), RESULT, code it under int main (must be blank){

In: Computer Science