Questions
The following is in C++. The instructions for completion are at the bottom. #include #include #include...

The following is in C++. The instructions for completion are at the bottom.

#include
#include
#include
#include
#include
#include

// function to determine if a token
vector is_token(const string& s) {
}

int main() {
// make this into a loop such that, like a terminal, input is accepted until the user hits CTRL+d
string str;
cout<<">";
getline(cin, str);

//vector to store the strings or characters returned by is_token() function
vector tokens;

tokens = is_token(str);
}

Modify the main() function to loop until the user exits (e.g. by pressing CTRL+d).

Write a function named is_token() that accepts a string of user input and determines what is a token (see below for token determination rules).
The function must return the separated tokens.

Determining if something is a token:

1. Whitespace (space, tab, etc) ends a token and is skipped unless it is in quotes (see below). You will find the function int isspace(char) useful for detecting whitespace characters.
2. Some characters are considered special tokens: | ; < > &. When one of these characters is encountered, the token being built is completed and a new token consisting of the character is created.
3. The character \ is a special character, i.e. an escape character. The next character will be part (or the start) of a token.
4. Items between single or double quotes are treated as parts of the current token.
5. Characters that do not meet the above rules are added on to the current token being built.

Some examples to test your output:

Input: > we\'ll do some "crazy \"air quotes\""
Output (tokens separated by commas): we'll, do, some, crazy "air quotes"

Input: > ls | sort >sorted_files.txt
Output (tokens separated by commas): ls, |, sort, >, sorted_files.txt

Input: > "now\;is"
Output: now;is

In: Computer Science

An electric utility company is considering construction of a new power facility in Albuquerque, New Mexico....

An electric utility company is considering construction of a new power facility in Albuquerque, New Mexico. Construction of the plant would cost $275 millioneach year for five years. Expected annual net cash flows are $85 million each year for five years.

Power from the facility would be sold in the Albuquerque and Santa Fe areas, where it is badly needed. The firm has received a permit, so the plant would be legal as currently proposed, but air pollution would be an issue with the new facility.

To alleviate the environmental concerns the company could spend an additional $50 millionwhen the plant is built. The additional funds cover the costs of special equipment designed to minimize the air pollution. At this time, the special pollution-abatement equipment is not required by law. If the firm adds the environmental protections to the facility, the expected annual net cash flows are $90 million for five years.

Unemployment rates are high in the area Where the plant would be built. The plant would provide about 500 new, well-paying jobs.

The risk-adjusted WACC for this project is 15%. As an employee of the utility company, you have been tasked with analyzing the project. You are to make your recommendations to the company’s Board of Directors in a memo.

  1. Calculate the NPV, IRR and regular Payback period for this project (with and without the environmental protection equipment).
  2. What is your recommendation for the utility company? Provide support for your responses.
  3. What additional qualitative/quantitative factors should be considered in accepting or rejecting both versions of this project? The factors might include job creation, salvage value, project life, discount rate (WACC) etc.

In: Finance

Write a C++ program to calculate the time to drain a cylindrical water tank for an...

Write a C++ program to calculate the time to drain a cylindrical water tank for an initial water height ranging from 1 to 10 feet (specifically for 1, 2, 4, 6, 8, and 10 ft). The tank has a radius (rt) of 2 feet and the drain radius (rd) is 0.3 inch. The gravitational constant (g) is 32.2 feet/sec2.

The formula for time to drain the tank is

time=(rtrd)2h/vavg

where, average velocity, vavg=0.5(2gh).5

In your program, assign the values to the variables rt, rd, and g. Prompt user to enter the value of h. The program should calculate the value of vavg, and then display time in hours.

Using MS Visual Studio, create a project folder called tank and a source code file tank.cpp.

Use the function pow() in the formulas and NOT sqrt().

Set up the output statements (cout) such that the one line display looks like the following:

Initial water height (ft.) = 1; Time to drain (hrs.) = 0.44

STEP 1: Analyze the Problem –

There is only one required output (time in hour of data type double) and one input (initial water height in ft of data type int). All intermediate variables will be assigned a data type of double.

STEP 2: Develop a Solution –

Pseudo code is shown below.

Convert all input data to the same unit (ft)

Display a prompt to enter initial height of water

Read a value for the height

Calculate average velocity, using the given formulas

Display the calculated time

Hand calculation for h = 1 ft, rt = 2 ft, rd = 0.3 inch, and g = 32.2 ft/sec2:

time = ?

STEP 3: Code the Solution -

You can start the program as shown below:

// Filename:

// C++ program to calculate time to drain water tank

// Written by: Your Name   ON: Date

#include <iostream>

#include <iomanip>

#include <cmath>

using namespace std;

int main()

{

     int h;

     double rt = 2.0, rd = 0.3, g = 32.2;

     double vavg, time;

// Input initial water height (h)

//---

// Set output formats

     cout << setiosflags(ios::fixed)

           << setiosflags(ios::showpoint)

           << setprecision(2);// Calculate average velocity in ft/hr

//---

// Calculate time in hrs to drain

// NOTE: The function pow(double a, int n) returns an

//---

// Display results in the specified format

//---

     return 0;

}

STEP 4: Test and Correct the Program -

If the program shows the correct output, copy and paste the output into MS Word. Also copy and paste the source code to the word processor as well. To copy the display window contents, click on the small black box in the upper left corner, select Edit -> Select All, then click again on the box and select Edit -> Copy.

Test the code by changing initial heights to 2, 4, 6, 8, and 10 feet.

In: Computer Science

The dividend-growth model, suggests that an increase in thedividend growth rate will increase the value...

The dividend-growth model, suggests that an increase in the dividend growth rate will increase the value of a stock. However, an increase in the growth may require an increase in retained earnings and a reduction in the current dividend. Thus, management may be faced with a dilemma: current dividends versus future growth. As of now, investors’ required return is 10 percent. The current dividend is $0.9 a share and is expected to grow annually by 5 percent, so the current market price of the stock is $18.9. Management may make an investment that will increase the firm’s growth rate to 9 percent, but the investment will require an increase in retained earnings, so the firm’s dividend must be cut to $0.7 a share. Should management make the investment and reduce the dividend? Round your answer to the nearest cent.

The value of the stock -Select- to $ , so the management -Select- make the investment and decrease the dividend.

In: Finance

Innovative Technology Corporation (ITC) estimates its WACC at 13%. It is considering projects PX, PY, and PZ.

Innovative Technology Corporation (ITC) estimates its WACC at 13%. It is considering projects PX, PY, and PZ. The financial manager, Lori, estimates the expected returns on these projects to be respectively 16% for PX, 12% for PY, and 10.9% for PZ. She estimates the betas to be 1.9 for PX, 1.0 for PY, and 0.7 for PZ. She also estimates the expected return on the market to be 12% and the risk-free rate is 6%.

a) If ITC ignores project risk and uses the WACC as a cut-off rate for acceptance or rejection, which projects would be accepted and which projects would be rejected?

b) Considering risk, which projects should be accepted or rejected? Why?

c) Draw the SML line and plot Projects PX, PY, and PZ on the same graph. Does the graph verify your answers to Part b. Please use excel to draw the graph?


Show steps please

In: Finance

You are doing an internship with Macy’s and are tasked with forecasting sales so that you...

You are doing an internship with Macy’s and are tasked with forecasting sales so that you can make inventory orders. You have weekly sales data for men’s dress shirts in your store from each of the past six weeks. You decide to try both a 3-period moving average and exponential smoothing with λ = 0.7 to see which model is more accurate and then use that one to make forecasts. The sales data is shown below.

Week # of Shirts Sold
1 423
2 448
3 437
4 361
5 395
6 416

What is the calculated MSE for the exponential smoothing method? Round intermediate calculations and final answer to 4 decimals.

What is the calculated MSE using the 3-period moving average? Round intermediate calculations and final answer to 4 decimals.

In: Statistics and Probability

You are doing an internship with Macy’s and are tasked with forecasting sales so that you...

You are doing an internship with Macy’s and are tasked with forecasting sales so that you can make inventory orders. You have weekly sales data for men’s dress shirts in your store from each of the past six weeks. You decide to try both a 3-period moving average and exponential smoothing with λ = 0.7 to see which model is more accurate and then use that one to make forecasts. The sales data is shown below.

Week # of Shirts Sold
1 423
2 448
3 437
4 361
5 395
6 416

What is the calculated MSE for the exponential smoothing method? Round intermediate calculations and final answer to 4 decimals.

What is the calculated MSE using the 3-period moving average? Round intermediate calculations and final answer to 4 decimals.

In: Statistics and Probability

1. A contractor is planning to use a crawler tractor with power shift transmission to push...

1. A contractor is planning to use a crawler tractor with power shift transmission to push 1,500 LCY. The tractor must haul the loose material up a 12% slope where it will be stockpiled for later removal. The contractor has measured the tractor blade load measurement: the pile length 12.6 ft, the pile width 8.1 ft, and the pile height 4 ft. The tractor weighs 44,400 pounds, and the coefficient of traction is estimated to be 0.7. The average haul distance is estimated to be 300 ft. The job efficiency is 50 minutes per hour. Performance characteristics of the tractor are shown in the lecture slides. (Note: 1 mi/hr = 88 ft/min).

1) What is the estimated productivity of the tractor? (First gear for dozing; Third gear for return.)

2) Estimate the total hours to complete the work.

3) Determine if the tractor can perform the work in the given condition above.

In: Civil Engineering

There is evidence that cytotoxic T lymphocytes (T cells) participate in controlling tumor growth and that...

There is evidence that cytotoxic T lymphocytes (T cells) participate in controlling tumor growth and that they can be harnessed to use the body's immune system to treat cancer. One study investigated the use of a T cell-engaging antibody, blinatumomab, to recruit T cells to control tumor growth. The data below are T cell counts (1000 per microliter) at baseline (beginning of the study) and after 20 days on blinatumomab for 6 subjects in the study. The difference (after 20 days minus baseline) is the response variable.

Baseline 0.04 0.02 0 0.02 0.32 0.42
After 20 days 0.18 0.37 1.2 0.15 1.02 0
Difference 0.14 0.35 1.2 0.13 0.7 -0.42

Do the data give evidence at the 5% level that the mean count of T cells is higher after 20 days on blinatumomab?

The test statistic is t =  (±±0.001)

Yes
No

In: Statistics and Probability

(please type not write down the answer) astronomy 3. A main sequence star of mass 15...

(please type not write down the answer) astronomy

3. A main sequence star of mass 15 M⊙ has a luminosity of approximately 10,000 L⊙ . a. At what rate does mass vanish as H is fused to He in the star’s core? Note: When we say “mass vanish” what we really mean is “gets converted into energy and leaves the star as light”. b. At what rate is H converted into He? To do this you need to take into account that for every kg of hydrogen burned, only 0.7% gets converted into energy while the rest turns into helium. c. Assuming that only the 10% of the star’s mass in the central regions will get hot enough for fusion, calculate the main sequence lifetime of the star. Put your answer in years, and compare to the lifetime of the Sun. It should be much, much shorter.

In: Physics