C++
Create a program which randomly generates 3 sets of x and y Integers and one randomly generated Integer. Two of the sets of Integers will represent the end points of a line segment. The other set of Integers and the other Integer will represent the midpoint of a circle and its radius.
The coordinates should be randomly generated using a user defined function that returns an Integer value based on from and to parameters; see the function declaration in the Other section below. Your coordinates should be randomly selected from -99 to 99. The radius should be a randomly generated number (using the same function) from 1 to 200.
Two other functions should be created to determine if a line segment is wholly within a circle. One of the functions should return the length of a line segment and the other will return a Boolean indicating if the passed line segment is in the passed circle; again, see the function declarations below.
The program should display all of the generated data and one of the messages regarding the location of the line as shown below in Output Layout section. Try to make everything line up correctly.
Output Layout:
Coordinates of a Random Line Segment 1st Point's x coordinate: -## 1st Point's y coordinate: -## 2nd Point's x coordinate: -## 2nd Point's y coordinate: -## Coordinates of a Random Circle coordinate: -## coordinate: -## Radius: ### The line segment is within the circle. OR The line segment is not within the circle.
Other: (Required Identifier Names, Prototypes & Random Ranges)
p0x // an int from -99 to 99 p0y // an int from -99 to 99 p1x // an int from -99 to 99 p1y // an int from -99 to 99 mpx // an int from -99 to 99 mpy // an int from -99 to 99 radius // an int from 1 to 200 int randomInteger(const int from, const int to); int lineSegLength(const int p0x, const int p0y, const int p1x, const int p1y); bool lineInCircle(const int p0x, const int p0y, const int p1x, const int p1y, const int mpx, const int mpy, const int radius);
In: Computer Science
Who is the current Texas governor and what political party does the governor represent? Discuss the governor’s informal powers. What are informal powers? How do the informal powers help the governor?
In: Psychology
Harvard Case: "Aspects of Sales Management: An Introduction"
List and discuss five categories of salesperson
Discuss four key aspects of sales compensation system
In: Operations Management
how to access server room, and how to remove signs when exit the gate door.
In: Computer Science
In: Operations Management
There are a variety of security mechanisms available to protect the enterprise network. Discuss how an enterprise might be attacked and the type of security device or mechanism you would select to combat the attack. What would you envision as being the legal, social, and ethical implications of using the security device or mechanism?
In: Computer Science
In: Finance
You are considering a 3-year project of which details are summarized below. Your required rate of return for capital budgeting purposes is 20 percent.
a. What is the project’s annual net income?
b. What is the project’s annual operating cash flow?
c. What is the project’s initial capital investment?
d. What is the project’s NPV?
e. What is the project’s IRR?
f. Should you accept this project? Why or why not?
In: Finance
We can find and sort the k largest elements of a set of size n in Θ(n + k log k) worst-case time.
Is this statement true?
In: Computer Science
How should an owner-manager prepare the business for a move from the planning phase to the implementation phase? Provide business examples to support your position.
In: Operations Management
. Explain Aristotle’s theory of the four causes
In: Psychology
How does public fear of crime influence criminal justice policy decisions? What drives the fear of crime by the public?
In: Psychology
Suppose your firm is considering investing in a project with the cash flows shown below, that the required rate of return on projects of this risk class is 10 percent, and that the maximum allowable payback and discounted payback statistics for your company are 3.0 and 3.5 years, respectively. Time: 0 1 2 3 4 5 Cash flow –$351,000 $66,800 $85,000 $142,000 $123,000 $82,200 Use the PI decision rule to evaluate this project. (Do not round intermediate calculations. Round your final answer to 2 decimal places.) PI Should it be accepted or rejected? Accepted Rejected
In: Finance
5) Assuming £1.00 = $1.45 and €1.00 = $1.25, the interest rate in the UK is 6.50% and the interest rate in Germany is 5.45%, determine the forward rate of the £ / € if interest rate parity (IRP) holds. What does this imply about future forward rates? Explain how you can engage in covered interest arbitrage if the spot rate remains the same, and the interest rate in the UK is still 6.50%, and the forward rate is .868 £ / € .
In: Finance
Suppose that XYZ Corp is considering financing a project with only equity. The project’s unlevered cost of capital is 10%. The project will require a $1000 initial investment today and pay incremental free-cash-flows of $100 in perpetuity starting the end of the next year. If the firm were to finance the project with debt so that its D/E ratio is 0.50 how will the NPV of the project change? Assume the interest rate on the new debt will be 3%, and the firm faces a 21% tax rate. Round your answer to two decimals.
In: Finance