Questions
//instructions Form: There should be at least 2 input fields for username and password. Use an...

  • //instructions
  • Form:
    • There should be at least 2 input fields for username and password.
  • Use an array as a database in which there are several usernames and passwords:
    • Usernames can be either emails or nick names (WITHOUT WHITE SPACE)
  • After the user submitted the form, students must:
    • sanitize the inputs
    • check if there is a match with one username and one password in the array.
    • If there is no match, print out an error message to user on the form.
    • If it is a match, redirect the user to a welcome page.

//code

   if(isset($_GET['submit'])){

//sanitize the input
      
/* Check the error from the input:
if input from user is empty
-> get an error string variable
if input is not empty
-> use preg_match() to match the pattern
$pattern = "/^[1-9][0-9]{2}(\.|\-)[0-9]{3}(\.|\-)[0-9]{4}$/";
-> if it's a matched, get a success string variable
*/
      
   }
?>






Lab 2-Part1

  



Phone Number
>
xxx.xxx.xxx or xxx-xxx-xxxx


     


          Must enter a valid phone number!
         


         


          Phone number is valid!
         



  
Submit






In: Computer Science

In the carnival game Under-or-Over-Seven, a pair of fair dice is rolled once, and the resulting...

In the carnival game Under-or-Over-Seven, a pair of fair dice is rolled once, and the resulting sum determines whether the player wins or loses his or her bet. For example, the player can bet $1 that the sum will be under 7—that is, 2, 3, 4, 5, or 6. For this bet, the player wins $1 if the result is under 7 and loses $1 if the outcome equals or is greater than 7. Similarly, the player can bet $1 that the sum will be over 7—that is, 8, 9, 10, 11, or 12. Here, the player wins $1 if the result is over 7 but loses $1 if the result is 7 or under. A third method of play is to bet $1 on the outcome 7. For this bet, the player wins $4 if the result of the roll is 7 and loses $1 otherwise.

(a) Construct the probability distribution representing the different outcomes that are possible for a $1 bet on being under 7.

(b) Construct the probability distribution representing the different outcomes that are possible for a $1 bet on being over 7.

(c) Construct the probability distribution representing the different outcomes that are possible for a $1 bet on 7.

(d) Show that the expected long-run profit (or loss) to the player is the same, no matter which method of play is used.

In: Statistics and Probability

This for a Python Class Suppose that a scientist is doing some important research work that...

This for a Python Class

Suppose that a scientist is doing some important research work that requires her to use rabbits in her experiments. She starts out with one adult male rabbit and one adult female rabbit. At the end of each month, a pair of adult rabbits produce one pair of offspring, a male and a female. These new offspring will take one month to mature and become adults.

To illustrate this, consider the first two months. At the beginning of month one, the scientist just has the original one pair of adult rabbits. A table for month one will look something like:

Month Adult Pairs of Breeders Adult Pairs of Non-breeders Pairs of Baby Rabbits Born (same as the # of breeder pairs) Sum of Breeders, Non-breeders, and Babies
1 0 1 0 1

At the end of month one, this pair of adults produce one pair of offspring. Thus, at the beginning of month two the table will look like this:

Month Adult Pairs of Breeders Adult Pairs of Non-breeders Pairs of Baby Rabbits Born (same as the # of breeder pairs) Sum of Breeders, Non-breeders, and Babies
1 0 1 0 1
2 1 0 1 2

At the end of month two, the adults have another pair of baby rabbits. The first pair of babies, born at the end of last month are not old enough to have babies yet, but we will categorize them as adults. So, at the beginning of month three the table looks like this:

Month Adult Pairs of Breeders Adult Pairs of Non-breeders Pairs of Baby Rabbits Born (same as the # of breeder pairs) Sum of Breeders, Non-breeders, and Babies
1 0 1 0 1
2 1 0 1 2
3 1 1 1 3
4 2 1 2 5

The scientist has 500 cages in which to hold her rabbits. Each cage holds one pair of rabbits. Assuming that no rabbits ever die, when will she run out of cages?

Your program must do the following:

  1. Open a text file rabbits.csv for writing.  Where it says "print" below, it means "write to the output file". Remember to close the file when done.
  2. Print a table that contains the following information for each month.
    • The number of months that have passed.
    • The number of adult rabbit pairs (those over 1 month old), which is the sum of adult breeders + adult non-breeders.
    • The number of baby rabbits pairs produced this month (same as the number of adult breeders this month).
    • The total number of rabbit pairs in the lab, which the sum of adult rabbits and baby rabbits
  3. Calculate how many months it will take until the number of rabbits exceeds the number of available cages (500).
  4. Stop printing when you run out of cages.
  5. Print a message giving how many months it will take to run out of cages

The output file should look like the following. Comments in the file begin with '#', and must appear as shown too:

# Table of rabbit pairs
Month, Adults, Babies, Total
1, 1, 0, 1
2, 1, 1, 2
3, 2, 1, 3
4, 3, 2, 5
5, 5, 3, 8
6, 8, 5, 13
7, 13, 8, 21
8, 21, 13, 34
9, 34, 21, 55
10, 55, 34, 89
11, 89, 55, 144
12, 144, 89, 233
13, 233, 144, 377
14, 377, 233, 610
# Cages will run out in month 14

In: Computer Science

DEPRECIATION METHODS Charlene is evaluating a capital budgeting project that should last for 4 years. The...

DEPRECIATION METHODS

Charlene is evaluating a capital budgeting project that should last for 4 years. The project requires $400,000 of equipment. She is unsure what depreciation method to use in her analysis, straight-line or the 3-year MACRS accelerated method. Under straight-line depreciation, the cost of the equipment would be depreciated evenly over its 4-year life (ignore the half-year convention for the straight-line method). The applicable MACRS depreciation rates are 33%, 45%, 15%, and 7%. The company's WACC is 13%, and its tax rate is 40%.

  1. What would the depreciation expense be each year under each method? Round your answers to the nearest cent.
    Year Scenario 1
    (Straight-Line)
    Scenario 2
    (MACRS)
    1 $ $
    2
    3
    4
  2. Which depreciation method would produce the higher NPV?
    -Select- straight line or MACRS

    How much higher would the NPV be under the preferred method? Round your answer to two decimal places. Do not round your intermediate calculations.

$

In: Finance

DEPRECIATION METHODS Charlene is evaluating a capital budgeting project that should last for 4 years. The...

DEPRECIATION METHODS

Charlene is evaluating a capital budgeting project that should last for 4 years. The project requires $375,000 of equipment. She is unsure what depreciation method to use in her analysis, straight-line or the 3-year MACRS accelerated method. Under straight-line depreciation, the cost of the equipment would be depreciated evenly over its 4-year life (ignore the half-year convention for the straight-line method). The applicable MACRS depreciation rates are 33%, 45%, 15%, and 7%. The company's WACC is 10%, and its tax rate is 40%.

  1. What would the depreciation expense be each year under each method? Round your answers to the nearest cent.
    Year Scenario 1
    (Straight-Line)
    Scenario 2
    (MACRS)
    1 $ $
    2
    3
    4
  2. Which depreciation method would produce the higher NPV?
    -Select-Straight-LineMACRSItem 9

    How much higher would the NPV be under the preferred method? Round your answer to two decimal places. Do not round your intermediate calculations.
    $

In: Finance

Understanding the optimal capital structure Review this situation: Transworld Consortium Corp. is trying to identify its...

Understanding the optimal capital structure

Review this situation: Transworld Consortium Corp. is trying to identify its optimal capital structure. Transworld Consortium Corp. has gathered the following financial information to help with the analysis.

Debt Ratio

Equity Ratio

EPS

DPS

Stock Price

30% 70% 1.55 0.34 22.35
40% 60% 1.67 0.45 24.56
50% 50% 1.72 0.51 25.78
60% 40% 1.78 0.57 27.75
70% 30% 1.84 0.62 26.42

Which capital structure shown in the preceding table is Transworld Consortium Corp.’s optimal capital structure?

Debt ratio = 30%; equity ratio = 70%

Debt ratio = 70%; equity ratio = 30%

Debt ratio = 60%; equity ratio = 40%

Debt ratio = 50%; equity ratio = 50%

Debt ratio = 40%; equity ratio = 60%

Consider this case:

Globo-Chem Co. is an all-equity firm, and it has a beta of 1. It is considering changing its capital structure to 70% equity and 30% debt. The firm’s cost of debt will be 8%, and it will face a tax rate of 25%.

What will Globo-Chem Co.’s beta be if it decides to make this change in its capital structure?     

Now consider the case of another company:

US Robotics Inc. has a current capital structure of 30% debt and 70% equity. Its current before-tax cost of debt is 8%, and its tax rate is 25%. It currently has a levered beta of 1.25. The risk-free rate is 2.5%, and the risk premium on the market is 8%. US Robotics Inc. is considering changing its capital structure to 60% debt and 40% equity. Increasing the firm’s level of debt will cause its before-tax cost of debt to increase to 10%.

First, solve for US Robotics Inc.’s unlevered beta.     

Use US Robotics Inc.’s unlevered beta to solve for the firm’s levered beta with the new capital structure.     

Use US Robotics Inc.’s levered beta under the new capital structure, to solve for its cost of equity under the new capital structure.     

What will the firm’s weighted average cost of capital (WACC) be if it makes this change in its capital structure?

12.00%

9.00%

7.80%

11.40%

In: Finance

In a study, you measure how many cups of coffee a random sample of 10 college...

In a study, you measure how many cups of coffee a random sample of 10 college students drink per day and their stress levels and obtain the following data:

Participant

Cups of Coffee

Stress Level

1

3

40

2

4

30

3

1

50

4

5

90

5

6

50

6

4

30

7

7

100

8

1

10

9

2

20

10

0

70

  1. Construct a scatterplot of the data (using a graph from Excel, another computer program that you are familiar with, or by hand).

  1. Compute the statistic that describes the nature of the relationship formed by the data.
  1. What is the proportion of variance in stress level that is accounted for by coffee consumption? (Be sure to interpret this value)
  1. What is the proportion of variance in stress level that is not accounted for by coffee consumption? (Be sure to interpret this value)
  1. Compute the linear regression equation for predicting stress level from coffee consumption.
  1. If a student drinks 3 cups of coffee per day, what would you predict that student’s stress level to be?
  1. Compute the linear regression equation for predicting coffee consumption from stress level.
  1. If a student has a stress level of 60, how many cups of coffee per day do you predict that student drinks?

In: Statistics and Probability

Suppose Anna hosts a cookout with 7 of her friends. She has purchased 8 burgers, 8...

Suppose Anna hosts a cookout with 7 of her friends. She has purchased 8 burgers, 8 steaks, and 5 pieces of chicken. If she wants to cook 16 food items in total (each person gets two items), including at least 2 burgers and 1 steak, how many possibilities are there to choose from what she purchased? Do not distinguish between who gets what, only consider the 16 food items.

(a) Solve using inclusion-exclusion.

(b) Solve using a generating function.

(C) What if two people want 3 food items, and the rest want 2 (and there are still at least 2 burgers and 1 piece of chicken among those cooked)?

In: Statistics and Probability

Kahn Inc. has a target capital structure of 50% common equity and 50% debt to fund...

Kahn Inc. has a target capital structure of 50% common equity and 50% debt to fund its $8 billion in operating assets. Furthermore, Kahn Inc. has a WACC of 15%, a before-tax cost of debt of 11%, and a tax rate of 25%. The company's retained earnings are adequate to provide the common equity portion of its capital budget. Its expected dividend next year (D1) is $3, and the current stock price is $32.

a) What is the company's expected growth rate? Do not round intermediate calculations. Round your answer to two decimal places.

%

b) If the firm's net income is expected to be $1.1 billion, what portion of its net income is the firm expected to pay out as dividends? Do not round intermediate calculations. Round your answer to two decimal places. (Hint: Refer to Equation below.) Growth rate = (1 - Payout ratio)ROE

%

In: Finance

student 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15...

student

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Test score

67

67

87

89

87

77

73

74

68

72

58

98

98

70

77

Above we have the final averages of the last stats and I want to know if the class average falls within the boundaries of all my statistics classes for the past 20 years.

Find the sample size, mean, and standard deviation of the data above (Table 1). Then use the 8-step method for determining whether or not last year’s class meets or exceeds the historical standards for statistics.

SIZE

MEAN

STANDARD DEVIATION

SAMPLE (last class)

15

POPULATION (all classes)

1,000

75

5.9

In: Statistics and Probability