Questions
This question demonstrates the use of inheritance and polymorphism. Design a Ship class that has the...

This question demonstrates the use of inheritance and polymorphism.
Design a Ship class that has the following members:
• A field for the name of the ship (a string).
• A field for the year that the ship was built (a string).
• A constructor and appropriate accessors and mutators.
• A toString method that overrides the toString method in the Object class. The Ship class
toString method should display the ship’s name and the year it was built.
Design a CruiseShip class that extends the Ship class. The CruiseShip class should have the following members:
• A field for the maximum number of passengers (an int).
• A constructor and appropriate accessors and mutators.
• A toString method that overrides the toString method in the base class. The CruiseShip class’s
toString method should display only the ship’s name and the maximum number of passengers.
Design a CargoShip class that extends the Ship class. The CargoShip class should have the following members:
• A field for the cargo capacity in tonnage (an int).
• A constructor and appropriate accessors and mutators.
• A toString method that overrides the toString method in the base class. The CargoShip class’s
toString method should display only the ship’s name and the ship’s cargo capacity.
Demonstrate the classes in a program that has a Ship array. Assign various Ship, CruiseShip, and CargoShip objects to the array elements. The program should then step through the array and print each object.

In: Computer Science

A regression model of the form y = beta0 + beta1 x1 + beta2 x2 +...

A regression model of the form

y = beta0 + beta1 x1 + beta2 x2 + beta3 x3 + E

was built using 20 observations. Partially completed regression output tables are provided below. What are the values of A, B, and C?

Table 1

Statistic

Value

R-Square

A

Adjusted R-Square

B

Standard Error (RMSE)

C

n

20

Table 2

Source

DF

SS

MS

F

P-Value

Regression

D

175

H

J

K

Error

E

G

I

Total

F

250

A regression model of the form

y = beta0 + beta1 x1 + beta2 x2 + beta3 x3 + E where E is assumed to be normal with mean 0 and constant variance.

was built using 20 observations. Partially completed regression output tables are provided below. What are the values of D, E, and F?

Table 1

Statistic

Value

R-Square

A

Adjusted R-Square

B

Standard Error (RMSE)

C

n

20

Table 2

Source

DF

SS

MS

F

P-Value

Regression

D

175

H

J

K

Error

E

G

I

Total

F

250

In: Statistics and Probability

Part A - For Loops (7 Marks) Charlie, an avid mountain biker, has purchased a new...

Part A - For Loops

Charlie, an avid mountain biker, has purchased a new multisport watch that measures data such as horizontal position, time, heart rate and elevation. The associated software for the watch allows for users to design their own apps that record new measurements. Charlie is interested in measuring their elevation gain and total distance travelled.

1. Write a MATLAB function that recieves vectors for horizontal position and elevation and outputs a plot of elevation vs. horizontal position. (1 mark)

2. Write a function that receives the vectors for horizontal position and elevation and outputs total distance travelled. You can assume that each point has been recorded sufficiently close together that a linear approximation incurs insignificant error. Your solution must use a for loop and is not allowed to use the in-built sum or diff functions. Hint: Calculate the distance between each coordinate and sum these distances together.

3. Elevation gain is a term used to describe the total vertical distance climbed up during uphill sections (downhill elevation changes are ignored). Write a function that receives an elevation vector and calculates the total elevation gain for the trip. Your solution must use a for loop and is not allowed to use the in-built sum or diff functions.

In: Computer Science

Python: Write a function that receives a one dimensional array of integers and returns a Python...

Python:

Write a function that receives a one dimensional array of integers and returns a Python tuple with two values - minimum and maximum values in the input array. You may assume that the input array will contain only integers and will have at least one element. You do not need to check for those conditions.

Restrictions: No built-in Python data structures are allowed (lists, dictionaries etc). OK to use a Python tuple to store and return the result.

Below is the starter skeleton code for this problem, on which the implementation must be built. Methods defined in the skeleton code must retain their names and input / output parameters. Variables defined in skeleton code must also retain their names.

from a1_include import

*def min_max(arr: StaticArray) -> ():

"""

TODO: Write this implementation

"""

return 0, 0

# BASIC TESTING

if __name__ == "__main__":

# example 1

arr = StaticArray(5)

for i, value in enumerate([8, 7, 6, -5, 4]):

arr[i] = value

print(min_max(arr))

# example 2

arr = StaticArray(1)

arr[0] = 100

print(min_max(arr))

# example 3

arr = StaticArray(3)

for i, value in enumerate([3, 3, 3]):

arr[i] = value

print(min_max(arr))

In: Computer Science

A bond with a face value of $1000 and maturity of exactly 20 years pays 10%...

A bond with a face value of $1000 and maturity of exactly 20 years pays 10% annual coupon. This bond is currently selling at an annual yield-to-maturity (YTM) of 12%. Answer the following questions for this bond.

a. Calculate the current price of the bond by discounting all the cash flows of the bond using the timeline method. b. Calculate the modified duration of the bond without using any Excel built-in function. (calculate PV of each cash flow, find the weight of each cash flow and then multiply time with the weight) c. Using modified Duration, calculate what would be the new price of the bond when YTM is 11%. d. Using modified Duration, what is the percentage change in price from the original level (found in part a) when YTM is 11%? e. Calculate convexity of the bond without using any Excel built-in function. f. Using the modified duration plus convexity model, what is the new price of the bond when YTM is 13%? g. Using the modified duration plus convexity model, what is the percentage price change from the original level (found in part a) of the bond when YTM is 13%.

Please only answer parts E,F & G

In: Finance

Provide the optimal Solution to the problems below using java code and include Time Complexity Analysis!...

Provide the optimal Solution to the problems below using java code and include Time Complexity Analysis!

  1. Peaks and Valleys

In an Array of integers, a “peak” is an element which is greater than or equal to the adjacent integers and a “valley” is an element which is less than or equal to the adjacent integers. For example, the array {5, 8, 6, 2, 3, 4, 6}, {8, 6} are peaks and {5, 2} are valleys. Give an array of integers, sort the array into an alternating sequence of peaks and valleys.

EXAMPLE

INPUT:

                                {5, 3, 1, 2, 3}

                OUTPUT:

{5, 1, 3, 2, 3}

  1. Build Order

You are given a list of projects and a list of dependencies (Which is a list of pairs of projects, where the second project is dependent on the first project). All of a project’s dependencies must be built before the project is. Find a build order that will allow the projects to be built. If there is no valid build order, return an error.

EXAMPLE

                INPUT:

                                Projects: a, b, c, d, e, f

                                Dependencies: (a, d), (f ,b), (b, d), (f, a), (d, c)

                OUTPUT:

f, e, a, b, d, c

(I need java code with explanation of algorithms and time complexity)

In: Computer Science

General Journal Entries One Product Corp. (OPC) incorporated at the beginning of last year. The balances...

General Journal Entries

One Product Corp. (OPC) incorporated at the beginning of last year. The balances on its postclosing
trial balance prepared on December 31, at the end of its first year of operations, were:

  Cash $ 19,500
  Accounts Receivable 8,250
  Allowance for Doubtful Accounts 885
  Inventory 12,060
  Prepaid Rent 1,600
  Equipment 25,000
  Accumulated Depreciation 2,400
  Accounts Payable 0
  Sales Tax Payable 500
  FICA Payable 600
  Withheld Income Taxes Payable 500
  Salaries and Wages Payable 1,600
  Unemployment Tax Payable 300
  Unearned Revenue 4,500
  Interest Payable 495
  Note Payable (long-term) 22,000
  Common Stock 13,300
  Additional Paid-In Capital, Common 19,210
  Retained Earnings 4,120
  Treasury Stock 4,000

The following information is relevant to the first month of operations in the following year:

  

OPC sell its inventory at $150 per unit, plus sales tax of 6%. OPC’s January 1 inventory balance consists of 180 units at a total cost of $12,060. OPC’s policy is to use the FIFO method, recorded using a perpetual inventory system.

The $1,600 in Prepaid Rent relates to a payment made in December for January rent this year.

The equipment was purchased on July 1 of last year. It has a residual value of $1,000 and an expected life of five years. It is being depreciated using the straight-line method.

Employee wages are $4,000 per month. Employees are paid on the 16th for the first half of the month and on the first day of the following month for the second half of each month. Withholdings each pay period include $250 of income taxes and $150 of FICA taxes. These withholdings and the employer’s matching contribution are paid monthly on the second day of the following month. In addition, unemployment taxes of $50 are accrued each pay period, and will be paid on March 31.

Unearned Revenue is for 30 units ordered and paid for in advance by two customers in late December. One order of 25 units is to be filled in January, and the other will be filled in February.

Note Payable arises from a three-year, 9 percent bank loan received on October 1 last year.
The par value on the common stock is $2 per share.
Treasury Stock arises from the reacquisition of 500 shares at a cost of $8 per share.

  

January Transactions

1.

On 1/01, OPC paid employees’ salaries and wages that were previously accrued on December 31.

2.

A truck is purchased on 1/02 for $10,000 cash. It is estimated this vehicle will be used for 50,000 miles, after which it will have no residual value.

3.

Payroll withholdings and employer contributions for December are remitted on 1/03.

4.

OPC declares a $0.50 cash dividend on each share of common stock on 1/04, to be paid on 1/10.

5.

A $950 customer account is written off as uncollectible on 1/05.

6. On 1/06, recorded sales of 175 units of inventory on account. Sales tax is charged but not yet collected or remitted to the state.
7. Sales taxes of $500 which had been collected and recorded in December are paid to the state on 1/07.
8. On 1/08, OPC issued 300 shares of treasury stock for $2,400.
9. Collections from customers on account, totaling $8,500, are recorded on 1/09.
10.

On 1/10, OPC distributes the $0.50 cash dividend declared on January 4. The company’s stock price is currently $5 per share.

11. OPC purchases on account and receives 70 units of inventory on 1/11 for $4,410.
12.

The equipment purchased last year for $25,000 is sold on 1/15 for $23,000 cash. Record depreciation for the first half of January prior to recording the equipment disposal.

13.

Payroll for January 1-15 is recorded and paid on 1/16. Be sure to accrue unemployment taxes and the employer’s matching share of FICA taxes.

14.

Having sold the equipment, OPC pays off the note payable in full on 1/17. The amount paid is $22,585 which includes interest accrued in December and an additional $90 interest through January 17.

15.

On 1/27, OPC records sales of 30 units of inventory on account. Sales tax is charged but not yet collected or remitted.

16.

A portion of the advance order from December (25 units) is delivered on 1/29. No sales tax is collected on this transaction because the customer is a United States governmental organization that is exempt from sales tax.

17.

To obtain funds for purchasing new equipment, OPC issued bonds on 1/30 with a total face value of $90,000, stated interest rate of 5 percent, annual compounding, and six-year maturity date. OPC received $81,420 from the bond issuance, which implies a market interest rate of 7 percent.

18. On 1/31, OPC records units-of-production depreciation on the vehicle (truck), which was driven 1,900 miles this month.
19.

OPC estimates that 2% of the ending accounts receivable balance will be uncollectible. Adjust the applicable accounts on 1/31, using the allowance method.

20. On 1/31, adjust for January rent expired.
21. Accrue January 31 payroll on 1/31, which will be payable on February 1. Be sure to accrue unemployment taxes and the employer’s matching share of FICA taxes.
22.

Accrue OPC’s corporate income taxes on 1/31, estimated to be $3,750.

Prepare all January journal entries and adjusting entries for items 1–19. Review the 'General Ledger' and the adjusted 'Trial Balance' Tabs to see the effect of the transactions on the account balances.

1

On 1/01, OPC paid employees’ salaries and wages that were previously accrued on December 31. Record the transaction.

2

A truck is purchased on 1/02 for $10,000 cash. It is estimated this vehicle will be used for 50,000 miles, after which it will have no residual value. Record the transaction.

3

Payroll withholdings and employer contributions for December are remitted on 1/03. Record the transaction.

4

OPC declares a $0.50 cash dividend on each share of common stock on 1/04, to be paid on 1/10. Record the transaction.

5

A $950 customer account is written off as uncollectible on 1/05. Record the transaction.

6

On 1/06, recorded sales of 175 units of inventory on account. Sales tax is charged but not yet collected or remitted to the state. Record the transaction.

7

On 1/06, recorded sales of 175 units of inventory on account. Sales tax is charged but not yet collected or remitted to the state. Record the transaction.

8

Sales taxes of $500 that had been collected and recorded in December are paid to the state on 1/07. Record the transaction.

9

On 1/08, OPC issued 300 shares of treasury stock for $2,400. Record the transaction.

10

Collections from customers on account, totaling $8,500, are recorded on 1/09. Record the transaction.

11

On 1/10, OPC distributes the $0.50 cash dividend declared on January 4. The company’s stock price is currently $5 per share. Record the transaction.

12

OPC purchases on account and receives 70 units of inventory on 1/11 for $4,410. Record the transaction.

13

The equipment purchased last year for $25,000 is sold on 1/15 for $23,000 cash. Record depreciation for the first half of January prior to recording the equipment disposal. Record the transaction.

14

The equipment purchased last year for $25,000 is sold on 1/15 for $23,000 cash. Record depreciation for the first half of January prior to recording the equipment disposal. Record the transaction.

15

Payroll for January 1-15 is recorded and paid on 1/16. Be sure to accrue unemployment taxes and the employer’s matching share of FICA taxes. Record the transaction.

16

Having sold the equipment, OPC pays off the note payable in full on 1/17. The amount paid is $22,585, which includes interest accrued in December and an additional $90 interest through January 17. Record the transaction.

17

On 1/27, OPC records sales of 30 units of inventory on account. Sales tax is charged but not yet collected or remitted. Record the transaction.

18

On 1/27, OPC records sales of 30 units of inventory on account. Sales tax is charged but not yet collected or remitted. Record the transaction.

19

A portion of the advance order from December (25 units) is delivered on 1/29. No sales tax is collected on this transaction because the customer is a United States governmental organization that is exempt from sales tax. Record the transaction.

20

A portion of the advance order from December (25 units) is delivered on 1/29. No sales tax is collected on this transaction because the customer is a United States governmental organization that is exempt from sales tax. Record the transaction.

21

To obtain funds for purchasing new equipment, OPC issued bonds on 1/30 with a total face value of $90,000, stated interest rate of 5 percent, annual compounding, and six-year maturity date. OPC received $81,420 from the bond issuance, which implies a market interest rate of 7 percent. Record the transaction.

22

On 1/31, OPC records units-of-production depreciation on the vehicle (truck), which was driven 1,900 miles this month. Record the transaction.

23

OPC estimates that 2% of the ending accounts receivable balance will be uncollectible. Adjust the applicable accounts on 1/31, using the allowance method. Record the transaction.

24

On 1/31, adjust for January rent expired. Record the transaction.

25

Accrue January 31 payroll on 1/31, which will be payable on February 1. Be sure to accrue unemployment taxes and the employer’s matching share of FICA taxes. Record the transaction.

26

Accrue OPC’s corporate income taxes on 1/31, estimated to be $3,750. Record the transaction.

In: Accounting

Suppose we have the following projects on two stocks. Assume thecorrelation among the two assets...

Suppose we have the following projects on two stocks. Assume the correlation among the two assets returns is 0.6

State of EconomyProbabilityStock AStock B
Recession0.2-2%6%
Slow0.448
Average0.41219

a. Find the expected return and standard deviation of shares A and B.

b. Find the investment percentage (weights) needed in A and B shares to create the minimum variance portfolio.

In: Finance

Nicholas Matveev wants to take a year-long cycling trip throughSouth America in three years.  He will...

  1. Nicholas Matveev wants to take a year-long cycling trip through South America in three years.  He will have to pay $5,000 costs at the start of the trip and then $1,000 per month for 12 months.  Assume the monthly payments are at the end of the month.  He has $1,000 saved now.  How much must he save each month until the trip if he earns 0.2% interest per month?

In: Finance

Amy’s income is $ 10,000 and she is risk averse. The probability of someone slipping on...

Amy’s income is $ 10,000 and she is risk averse. The probability of someone slipping on her sideway is 1/8. If this happens, she will be sued for $5,000 and will have to pay that amount. She can purchase insurance at a price of $0.2 per dollar of coverage. Show how the equilibrium amount of insurance coverage is determined. If her utility of money is given as U=m0.5, where m is the money amount in a particular state, calculate the optimal insurance.

In: Economics