1.If a stock is purchased for $100 per share and held one year, during which time a quarterly dividend of $1.5 is paid, each quarter, and the price climbs to $130 per share. What is the rate of return?
2.What should be the price for a common stock paying $1.35 annually in dividends if the dividend will remain constant (zero growth of dividend), indefinitely, and the expected return is 5.5%?
3.If the dividend yield for year one is expected to be 4% based on the current price of $80, what will year seven dividend (DIV7) be if dividends grow at a constant 2%?
4.What dividend per share would be reported in the financial press for a stock that currently has 4.5% dividend yield and the most recent stock price was $75?
5.What would be the stock price today if you know you will sell the stock in 2 years from today at $55/share and you expect annual dividends $2/share in year 1 and $3/share in year 2, given the discount rate is 10%?
In: Accounting
The market and Stock J have the following probability
distributions:
| Probability | rM | rJ |
| 0.3 | 12% | 20% |
| 0.4 | 8 | 7 |
| 0.3 | 17 | 13 |
Calculate the expected rate of return for the market. Round your
answer to two decimal places.
Calculate the expected rate of return for Stock J. Round your
answer to two decimal places.
Calculate the standard deviation for the market. Do not round intermediate calculations. Round your answer to two decimal places.
Calculate the standard deviation for Stock J. Do not round
intermediate calculations. Round your answer to two decimal
places.
In: Finance
Last year, Joan purchased a $1,000 face value corporate bond with an 8% annual coupon rate and a 25-year maturity. At the time of the purchase, it had an expected yield to maturity of 9.62%. If Joan sold the bond today for $1,053.36, what rate of return would she have earned for the past year? Round your answer to two decimal places.
In: Finance
2000-0600: Jevity 50 mL/hr, 0615: 50 cc free water flush, 2100-0215: Two 250 mL of red blood cells, 0115: 20 cc saline flush IV, 0300: Zosyn IV 50 mL, 0400: 10cc Saline flush IV, Continuous fluid: Heparin 10 mL/ hr & Normal Saline 100 mL/hr, Illeostomy: 300 mL, NG suction: 50 cc, Urine: 1850 mL, Wound vac 100 cc
During your 12-hr shift from 7-7pm, what is your patients intake and output? (PLEASE SHOW STEP BY STEP)
In: Nursing
As indicated below, use two different notations for each isotope. Spelling counts!
Description Notation 1 Notation 2
contains 7 protons, 7 electrons, 8 neutrons 15 over 7 N Nitrogen-15
contains 4 protons, 4 electrons, 6 neutrons ? ?
contains 11 protons, 11 electrons, 14 neutrons ? ?
contains 52 protons, 51 electrons, 74 neutrons ? ?
In: Chemistry
Problem description
Write a program that uses a loop to read integer values from the standard input stream. Each non-zero value, x, is the first number of a sequence.
Define a0 = x; an+1 = an / 2 if an is even; an+1 = 3 * an + 1 if an is odd. Then there exists an integer k such that ak = 1.
For each non-zero value of x, the program outputs the integer k such that ak = 1 and the numbers a0, a1, a2, ..., ak, the value of k, the largest number in the sequence, and its position in the sequence. (See Output specification.)
Input specification
The input will consist of a series of non-negative integers, one integer per line. All integers will be less than 65536. The last integer in the series is zero, signalling the end of input. You can assume that no operation overflows a 32-bit integer. (See Sample input.)
Output specification
The program writes to the standard output stream.
There will be two lines of output for each line of input. The output should be formatted exactly as specified.
For each non-zero integer input, you should output the sequence a0, a1, a2, ..., ak, terminated by a newline. On the next line you should output the value of k, the largest number in the sequence, and its position in the sequence. These three numbers should be separated by one space with all three numbers on one line, terminated by a newline. (See Sample interaction.)
Sample input
I have provided sample input and expected output files in our shared directory. For example:
$ cat /home/shared/cs135/kmess/pa05-input0.txt 24 106 7 0 $
Sample interaction
$ ./a.out < pa05-input0.txt 24 12 6 3 10 5 16 8 4 2 1 10 24 0 106 53 160 80 40 20 10 5 16 8 4 2 1 12 160 2 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 16 52 5 $
Note: If you use geany to build the executable, use pa05 instead of a.out.
Judge script
You can validate your program's output using the judge. I have provided a couple sets of input files and expected output files for you in our shared directory. Assuming you copied these files to your project directory, you can use the following command:
$ judge -p a.out -i pa05-input0.txt -o pa05-output0.txt
You may append the -v option to the above command to enable verbose output.
Note: If you use geany to build the executable, use pa05 instead of a.out.
Assignment-specific requirements
The General Programming Guidelines apply (e.g., readability, documentation, restricted keywords, etc). This program expects input from cin and output to cout; do not use any ifstream or ofstream variables in this program.
In: Computer Science
You are being tested for psychic powers. Suppose that you do not have psychic powers. A standard deck of cards is shuffled, and the cards are dealt face down one by one. Just after each card is dealt, you name any card (as your prediction). Let X be the number of cards you predict correctly. (See Diaconis (1978) for much more about the statistics of testing for psychic powers.) (a) Suppose that you get no feedback about your predictions. Show that no matter what strategy you follow, the expected value of X stays the same; find this value. (On the other hand, the variance may be very different for different strategies. For example, saying “Ace of Spades” every time gives variance 0.) Hint: Indicator r.v.s. (b) Now suppose that you get partial feedback: after each prediction, you are told immediately whether or not it is right (but without the card being revealed). Suppose you use the following strategy: keep saying a specific card’s name (e.g., “Ace of Spades”) until you hear that you are correct. Then keep saying a different card’s name (e.g., “Two of Spades”) until you hear that you are correct (if ever). Continue in this way, naming the same card over and over again until you are correct and then switching to a new card, until the deck runs out. Find the expected value of X, and show that it is very close to e − 1. Hint: Indicator r.v.s. (c) Now suppose that you get complete feedback: just after each prediction, the card is revealed. Call a strategy “stupid” if it allows, e.g., saying “Ace of Spades” as a guess after the Ace of Spades has already been revealed. Show that any non-stupid strategy gives the same expected value for X; find this value. Hint: Indicator r.v.s.
In: Statistics and Probability
Purpose
For this programming project, you will create an
application that draws fractal-like shapes using recursion. The
class that creates the graphics window for the display of the
shapes is given to you (see below). What you have to do is create a
set of classes for the three shapes that are displayed in the
graphics window. Two of the shapes must be a Sierpinski triangle
and an H-shape. The third shape is your choice, though it must be a
fractal-like shape. There is also the possibility of earning a few
extra-credit points (up to 3 points) by allowing some deformation
of the shapes while moving a slider on the graphics
window.
FractalDisplay class (code:
http://flepeint.ccfaculty.org/java143/hw3/FractalDisplay.java)
The FractalDisplay class is given and requires very
minimal coding on your part. Instantiating the FractalDisplay class
displays a graphics window, which features 3 radio buttons for the
selection of the shapes, two buttons to add or remove a level to
the shapes, and a slider that when moved should deform the shapes
in an interesting manner. The slider feature is not required and
should only be attempted for extra-credit once the rest of the
assignment is completed.
The only code you will write in FractalDisplay is to
call the constructors of the three concrete shape classes of this
project, namely the SierpinskiTriangle, HShape, and MyShape
classes. Look for the comment //TODO. Only 3 lines of code are
needed, one for each of the calls of the constructors of the three
concrete shape classes.
Drawing of the shapes
For this programming project, three shapes are
required. Two of them must be a Sierpinski triangle and an H shape.
The third one is your choice, though it must be a fractal-like
shape. You can get some ideas by consulting this page.
The Sierpinski triangle starts with one triangle. We
call this level 1 of the triangle. At level 2, 3 triangles are
added inside of the first triangle. At level 3, 3 more triangles
are added inside of the three level 2 triangles. Mathematically,
the process goes on forever. For our display, this is of course not
possible since we are limited by the size of single pixel on the
computer screen. We will limit the level to a maximum value of 10
for the Sierpinski triangle.
Level 1: 1 triangleLevel 2: 1 + 1 * 3 = 4 trianglesLevel 3: 1 + 1 *
3 + 3 * 3 = 13 triangles
The H-shape follows the same pattern as the Sierpinski
triangle.
Initially, at level 1, there is one H. At level 2, 7
H's are drawn within the seven squares making up the original H.
And at level 3, 7 more H's are added in the 7 seven H's of level 2.
As for the Sierpinski triangle, we need to limit the level to a
maximum value, which will be 5 for the H shape.
Level 1: 1 HLevel 2: the shape has 1 + 1 * 7 = 8 H's (but only the
last level is drawn since the level 1 H would hide the smaller H
shapes)Level 3: the shape has 1 + 1 * 7 + 7 * 7 = 57 H's (though
only the level 2 H's are displayed)
Organization of the shape classes
Since the 3 shapes that are displayed have many
features in common (e.g. all of them may add a level or remove a
level), we want to use inheritance to avoid code repetition. To do
so, we start by listing all of the common methods in a Shape
interface. As an aside, notice that the code of FractalDisplay
knows only about the Shape type except for the actual constructor
calls of the concrete shape classes. This is of course the
advantage of using inheritance. It creates a low coupling between
the FractalDisplay class and the concrete shape classes, that is
the code of FractalDisplay doesn't rely heavily on the
implementation of the Shape interface by the concrete shape
classes.
The Shape interface will contain the following
methods
void draw(Graphics g)Draws this shapeboolean addLevel()Adds a level
to this shape. Returns true if the operation was successful or
false if the maximum level has been reached.boolean
removeLevel()Removes a level from this shape. Returns true if the
operation was successful or false if the shape was at level 1.int
countShapes()Returns the total number of shapes of this shape (e.g.
57 for the H shape at level 2).void update(int value)Modifies this
shape in an interesting way given a value in the range 0-100. This
method is only required for the extra-credit part.
When thinking about the implementation of the Shape
interface by the concrete shape classes, you will notice many
similarities between all of the implementations. For that reason,
it is a good idea to create an abstract class AbstractShape that
implements Shape and contains the code that is common to all three
concrete shape classes. By inheriting AbstractShape, the concrete
shape classes get the methods implemented in AbstractShape and just
need to add their own specific code (e.g. the implementation of the
draw method). This is leading us to the following class
hierarchy:
As just mentioned, AbstractShape will contain the
fields and methods that can be used by all of the concrete shape
classes. For instance, all shapes have a level, a maximum level
value, a color, and may have children shapes (e.g. any Sierpinski
triangle may have 3 inner triangles, and any H may have 7 inner
H's). A possible design of AbstractShape would list fields to store
that information. For instance:
public abstract class AbstractShape implements Shape
{
protected int level;
protected int maxLevel;
protected AbstractShape[] children;
protected Color color;
// The fields may be initialized by the AbstractShape constructor
with the values
// received from the super() calls in the constructors of the
concrete shape classes.
// For instance, the SierpinskiTriangle constructor may call the
AbstractShape constructor with
// the a max level value of 10 and a children array length of
3
// Alternatively the fields may be initialized in the concrete
class constructors (they are visible by
// the concrete classes since they are declared
protected)
What precisely goes in the AbstractShape class depends
on your implementation design, though I strongly recommend that you
follow the guidelines given in the next section. In any case, make
sure that you avoid any code repetition among your implementations
of the concrete classes. It is possible to have all of the methods
of the Shape interface implemented by AbstractShape except for the
draw method (and possibly the update method if you attempt the
extra credit part).
Implementation details
The details outlined below use the HShape and
SierpinskiTriangle classes as illustrations. However, they should
be readily applicable to the fractal shape that you select as your
third shape (coded in the MyShape class).
addLevel() method (must use
recursion)
As mentioned in the previous section, it is possible
to implement the addLevel method in the AbstractShape class. The
only addition to a concrete class can just be a method to create
the actual child shapes.
To model the Sierpinski triangle, we can think of the
triangles at level n as being the children of the triangle at level
n-1. For instance, for a Sierpinski triangle with three levels, the
level 1 triangle has three children which are the three level 2
triangles. Each of the three level 2 triangle has also three
children on level 3, for a total of nine triangles. And the nine
triangles at level 3 have no children since they are on the last
level.
For the H shape, a division can be thought of creating
a covering of 7 smaller H's for every H making up the shape. That
is we can think of an HShape has having 7 children.
Even though the construction of the Sierpinski
triangle and the H are different, we can use the same approach for
both and write some of the code in their common AbstractShape base
class.
In the AbstractShape class, add an array of
AbstractShape objects to store the AbstractShape objects that are
the child shapes. For example, the array will be of length 3 for a
Sierpinski triangle and of length 7 for an H shape. The array may
be initialized in the constructor of AbstractShape if the
AbstractShape constructor takes the array length as a parameter, or
directly in the constructor of the concrete classes if you make the
visibility of the array protected. The elements of the children
array are null for an initial fractal. When level 2 is created, the
array is filled with actual shapes. For level 3, it is the arrays
of the shapes that are added at level 2 that are filled,
etc.
In the AbstractShape class, implement the addLevel()
method to add a level to a shape. It will do so by initializing the
elements of the array of children for the last current level. In
the FractalDisplay class, you can check that the method is called
whenever the "Add level" button is clicked. Since the
FractalDisplay class has only a reference to the top level shape,
the method will iterate to get to the last level of the shape. Do
so by using recursion (don't use any loop, except to loop over the
elements of the array of children in a current level.) The base
case of the method will be attained when the array of children is
empty. Fill the array of children by calling a method (e.g.
createChildren()) declared abstract in AbstractShape and
implemented in the concrete shape classes. Dynamic binding will
automatically select the correct implementation! Of course, the
array should be filled only if the maximum level has not been
reached. Return a boolean to tell it if a new level could be added.
The boolean value is relayed to the FractalDisplay class to tell it
if the operation was successful. If a new level could not be added,
then the FractalDisplay displays a message box saying that no new
level can be added.
removeLevel() method (must use
recursion)
In the AbstractShape class, implement removeLevel() to
remove a level from a shape. If a shape has n levels, the last
level may be removed by setting to null the elements of the array
of children at level n-1. This method is called by the
DisplayFractal class whenever the button "Remove level" is clicked.
Contrary to the addLevel method, removeLevel won't iterate to the
last level of the selected shape. It will iterate to the level
preceding the last level. This is because to remove the last level,
the method needs to set to null the elements of the array of
children that refer to that last level. As for addLevel, iterate by
using recursion (that is don't use any loop, except to loop over
the elements of the array of children in a current level.) If the
shape that is displayed is at level 1, a level can't be removed. In
that case, removeLevel returns false. The boolean value will be
passed on to the display so that it can display a message box if a
level could not be removed.
countShapes() method (must use
recursion)
In the AbstractShape class, implement countShapes() to
count the total number of shapes in a shape. If there is only one
shape (level 1), the count is 1. For a shape with two levels, the
count is 1 + number of shapes at level 2, that is 4 triangles for a
Sierpinski triangle with two levels, or 8 H's for an H with two
levels. For a shape with three levels, the counts are 13 for a
Sierpinski triangle and 57 for an H.
As for addLevel and removeLevel, your implementation
must use recursion except to loop over the children shapes in a
current level.
The countShapes() method is called from the
FractalDisplay class whenever the mouse is right clicked on a
shape.
draw() method (must use recursion)
This is the method that must be implemented in each
concrete class (SierpinskiTriangle, HShape and MyShape). The method
takes a Graphics object that can draw almost anything. Check the
documentation of the Graphics class in the java documentation
pages. For example, the Sierpinski triangle may be drawn by
invoking the drawPolygon method.
As for all of the other methods discussed in this
section, use recursion to implement the method except to loop over
the array of children.
Extra-credit (up to 3 points)
Implement the update() method that takes an integer in
the 0-100 range and modifies the display of the current shape as a
function of the value of the integer. The value is changed by
moving a slider on the display window. Initially the value given by
the slider is set at 50. As an illustration, here is an example
with the Sierpinski triangle
In: Computer Science
CompUSA Inc. sells computer hardware. It also markets related software and software-support services. The company prepares annual forecasts for sales, of which the first six months of 2019 are given below.
In a typical month, total sales are broken down as follows: cash sales, 30%; VISA® credit card sales, 65%; and 5% open account (the company’s own charge accounts). For budgeting purposes, assume that cash sales plus bank credit card sales are received in the month of sale; bank credit card sales are subject to a 3% processing fee, which is deducted daily at the time of deposit into CompUSA’s cash account with the bank. Cash receipts from collection of accounts receivable typically occur as follows: 20% in the month of sale, 50% in the month following the month of sale, and 27% in the second month following the month of sale. The remaining receivables generally turn out to be uncollectible.
CompUSA’s month-end inventory requirements for computer hardware units are 30% of the following month’s estimated sales. A one-month lead time is required for delivery from the hardware distributor. Thus, orders for computer hardware units are generally placed by CompUSA on the 25th of each month to ensure availability in the store on the first day of the month needed. These units are purchased on credit, under the following terms: n/45, measured from the time the units are delivered to CompUSA. Assume that CompUSA takes the maximum amount of time to pay its invoices. On average, the purchase price for hardware units runs 60% of selling price.
| CompUSA Inc. Forecasted Sales (units and dollars) January–June 2019 |
|||||||||||||||
| Number of Units |
Hardware Sales |
Software/ Support Sales |
Total Revenue |
||||||||||||
| January | 120 | $ | 360,000 | $ | 140,000 | $ | 500,000 | ||||||||
| February | 130 | 390,000 | 160,000 | 550,000 | |||||||||||
| March | 90 | 270,000 | 130,000 | 400,000 | |||||||||||
| April | 100 | 300,000 | 125,000 | 425,000 | |||||||||||
| May | 110 | 330,000 | 150,000 | 480,000 | |||||||||||
| June | 120 | 360,000 | 140,000 | 500,000 | |||||||||||
| Totals | 670 | $ | 2,010,000 | $ | 845,000 | $ | 2,855,000 | ||||||||
Required:
1. Calculate estimated cash receipts for April 2019.
2. The company is looking at the number of hardware units to order on January 25.
a. Determine the estimated number of units to be ordered.
b. Calculate the dollar cost (per unit and total) for these units.
3. Cash planning in this line of business is critical to success. Management feels that the assumption of selling price per unit ($3,000) is firm—at least for the foreseeable future. Also, it is comfortable with the 30% rate for end-of-month inventories. It is not so sure, however, about (a) the Cost of Goods Sold (CGS) rate (because of the state of flux in the supplier market) and (b) the level of predicted sales in March 2019. Discussions with marketing and purchasing suggest that three outcomes are possible for each of these two variables, as follows:
| Outcome | March Sales | CGS% | ||
| Optimistic | 100 | units | 55 | % |
| Expected | 90 | units | 60 | |
| Pessimistic | 80 | units | 65 | |
The preceding outcomes are assumed to be independent, which means that there are nine possible combinations (3 × 3). You are asked to conduct a sensitivity analysis to determine the range of possible cash outflows for April 10, under different combinations of the above. Assume, for simplicity, that sales volume for April is fixed. Complete the following table:
In: Accounting
For a comparison of two study guides for a mathematics course, 14 student volunteers were found. They were randomly assigned, 7 to study guide A, and 7 to study guide B. Following a two-day period of independent study, the students were examined on the material. The students received the following scores (out of 100):
Study Guide A: 95 96 97 80 92 97 95
Study Guide B: 72 73 80 69 78 74 73
Use a permutation test to test the null hypothesis that the distributions of scores are the same for each study guide, against the two-sided alternative that the distributions are different.
1. How many possible ways are there to randomly allocate the 14 students into two groups of 7 students? [2 pt(s)]
2. Compute the difference in sample means, A(bar) - B(bar) as the test statistic. [1 pt(s)]
3. How many arrangements of the data would lead to an absolute value of the computed test statistic as great or greater than the absolute value of the test statistic you calculated in the previous question? Note that you don't have to list all possible arrangements in order to answer this. Examine the data carefully and use the trick that was shown in class (also on pages 8-9 of the typed notes) for the permutation problem. [5 pt(s)]
4. Suppose that after examining all the possible arrangements, it is found that the absolute value of the difference in means for 16 of the arrangements (including the real one that you observed) are greater than or equal to the absolute value of the computed test statistic. What is the two-sided p-value for the permutation test? Use at least 5 digits to the right of the decimal. [2 pt(s)]
In: Statistics and Probability