Would stirring a cup of tea show any sign of a two dimensional vector? This is my own question I am asking. My personal question.
In: Physics
Single Lane Bridge Problem : Java Threads
Given :
//Use ReentrantLock for mutual exclusion
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public class bridge { private final ReentrantLock myLock = new ReentrantLock(); public bridge(){ } public String cross(){ myLock.lock(); try { return "crossing the bridge"; } finally { myLock.unlock(); } } }
public class lane extends Thread { int cars; bridge Bridge; public lane(int Cars1, bridge Bridge1) { cars = Cars1; Bridge = Bridge1; } public void run(){ for(int x=0;x
//Important clue :
<Thread-ID> waiting to cross
This means that this thread is now competing for the lock and will have to wait its turn.
- Once a thread has gained access to the critical section it should output:
<Thread-ID> crossing the bridge
- It takes different cars a different amount of time to cross the bridge, so your code should simulate this by sleeping for a random amount of time when accessing the critical section.
- Once a car has left the bridge, your program should output:
<Thread-ID> exiting
- Threads can enter the critical section in any order.
Create main such that the output is as follows :
Thread-0 waiting to cross
Thread-0 crossing the bridge
Thread-0 exiting
Thread-1 waiting to cross
Thread-2 waiting to cross
Thread-1 crossing the bridge
Thread-1 exiting
Thread-2 crossing the bridge
Thread-2 exiting
.....
.....
.....
.....
In: Computer Science
“Computer programming is creating a sequence of very precise instructions written in a language a computer understands, to perform a specified task with a computer.” Discuss in detail the concept of extreme precision in computer programming.
In: Computer Science
A. Develop a cost equation on the following: Franklin Foods has current year costs consisting of $5 per unit Variable Costs and $10,000 in Fixed Costs. Assume that Franklin Foods and a major supplier have entered into a partnership that will result in a per-unit decrease in Franklin's variable cost of $0.75 next year. The company will also be able to reduce their annual leasing costs by 25%. What is the new cost equation, and what will be the estimated total costs if production is estimated to be 13,500 units next year? Explain your findings.
B. Explain the differences between fixed, variable, and mixed costs.
In: Accounting
Account |
Balance 12/31/2013 |
Balance 12/31/2014 |
Accounts payable |
$1000 |
$1100 |
Accounts receivable |
$2480 |
$2690 |
Cash |
$1300 |
$1090 |
Common stock |
$4990 |
$4990 |
Inventory |
$5800 |
$6030 |
Long-term debt |
$7800 |
$8200 |
Three-month Notes payable |
$ 800 |
$ 960 |
Plant, property, and equipment |
$6380 |
$6530 |
Retained earnings |
$1370 |
$1090 |
In: Finance
Left shift.
I am trying to left shift a string located in a text file. I am using c++ and the goal is to left shift by 1 character a string of length N, and output on stdout all of the performed shifts. Can someone tell me what I am doing wrong, and tell me what I can fix?
i.e: text file contains: Hi there!.
Output on stdout:
Hi there!, i there!H, _there!Hi, there!Hi_,...., !Hi_there. #here "_" represent space.
-------------------------------------------------------------------------------------------------------------------------
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
using namespace std;
void shiftleft (vector <string> array, int d)
{
reverse(array.begin(), array.begin() + d);
reverse(array.begin() + d, array.end());
reverse(array.begin(), array.end());
}
int main()
{
string input_line;
vector<string> value;
ifstream file("LeftShift2.txt");
if(file.is_open())
{
while(getline(file, input_line))
{
value.push_back(input_line);
for(int i = 0; i < value.size(); i++)
{
cout << value[i] << "---->"<<endl;
shiftleft (value, 1);
}
}
}
}
--------------------------------------------------------------------------------
LeftShift2.txt
Hi there!
In: Computer Science
Describe the basic criteria for schizophrenia based on the current DSM criteria. Explain the differences between negative and positive symptoms.
In: Psychology
Year Return
2013 0.24
2014 0.14
2015 0.16
2016 0.08
Find the geometric expected return for this asset.
In: Finance
An electronics distributor sells a technology product with a very short lifecycle. The distributor orders the product from the manufacturer before observing demand and, due to the length of the supply chain, is unable to order more within the product life cycle. The manufacturer builds the product to order at a cost of $50 per unit and sells it to the distributor for $95 per unit. The distributor sells the product to its customers for $180 per unit. Demand for the product during its life cycle is expected to be normally distributed with a mean of 8,000 units and a standard deviation of 3,500. Any units left over at the end of life cannot be sold. In fact, due to hazardous materials used in the product, a fee of $5 per unit must be paid to properly dispose of any leftover units.
a. Using the single period (aka news vendor) model, what order quantity would maximize expected profit for the distributor? (Hint: think about what the price and cost would be from the distributor’s perspective.)
b. What order quantity would maximize expected profit for the supply chain (manufacturer plus distributor, i.e., the “globally optimal” order quantity)? (Hint: think about what the price and cost are for the overall supply chain.)
c. Suppose the manufacturer offers to reduce the price it charges the distributor to $55 in return for 15% of the distributor’s revenue from sales of the product. Explain why this type of revenue sharing contract is beneficial for the supply chain
In: Operations Management
Describe the physical changes both boys and girls go through during puberty. How does the increase in hormone production affect them? Physically, teenagers are sexually mature, however, are often not cognitive, socially, or emotionally ready for sex. One reason is brain development. Describe how frontal lobe development in the brain compares to hormone production. How might the delay of the frontal lobe development affect a teenager’s decisions about sex? Could it lead to risky decision making?
In: Psychology
There is a riskless asset with a return of 0.020, and a risky asset with an expected return of 0.363 and standard deviation of 0.301. If you were building a portfolio for an investor with a risk aversion of A=2.6, what proportion of their assets would you invest in the risky asset?
In: Finance
18. DEFINE “PROGRESSIVE DELEGATION” EXPLAINING THE PROCESS AND ITS ADVATANGES
In: Operations Management
The December 31, 2017 statement of financial position of the ABC Company included the following information:
Accounts Receivable €112,000 Less: Allowance for Doubtful Accounts €2,240
During the company’s fiscal year ending December 31, 2018, the following transactions occurred:
1. Sales on credit €437,300;
2. Collections on accounts previously written off as worthless €230 (Hint: Re-establish the receivable account);
3. Accounts receivable written off as uncollectible €2,290;
4. Collections of accounts receivable €440,500;
5. Bad debts were estimated to be 1,8% of accounts receivable.
Instructions a) Prepare journal entries necessary for ABC Company to record the preceding transactions. b) Prepare an analysis and schedule that shows the amounts of the accounts receivable, allowance for doubtful accounts that will be disclosed on ABC’s December 31, 2018 statement of financial position
In: Accounting
Read the article below and analyze it.
Which Behaviors Must Leaders Avoid
If you want to empower, engage, or motivate others, don’t just focus on increasing your positive behaviors. Pay attention to what you need to stop doing as well. Why? Because people remember the bad more than the good. To quote from a previous HBR article, How to Play to Your Strengths, “Multiple studies have shown that people pay keen attention to negative information. For example, when asked to recall important emotional events; people remember four negative memories to every positive one.” So, which behaviors do leaders most need to avoid? Drawing on thousands of 360 qualitative interviews, here are our top three:
Judgmental, non-verbal body language. No one, especially your successful colleagues, can tolerate perceived condescension. Research studies show that somewhere between 75 to 90 percent of our impact comes from our non-verbal communication, and tone is a key ingredient of this. Do you make comments to others in a way that sounds evaluative, harsh, or condescending? Often, this is not our intention but an in-the- moment reaction. Other non-verbal offenders include scowling, furrowed brows, quizzical looks (as if to say, ‘are you stupid?’), rigidity, and sarcasm. While seemingly small, each of these subtle darts creates a considerable amount of relationship damage.
Interrupting and interrogating. There’s been a lot of buzz recently around how to have “conversations that drive innovation” and how to “create safe environments for employees to bring their ideas forward.” It’s almost impossible for people to feel safe if the boss takes up most of the airtime, cuts people off, or interrogates half-baked ideas. Yes, employees have a responsibility to communicate with clarity, but if you expect every idea to be buttoned up, fully thought out, or structured before someone speaks, your colleagues will assume that you’re not willing to invest the time to be a thought partner.
Being inconsistent. Peers and staff often comment on how discouraging it is to see a colleague act in two very different ways — absolutely charming with the executive team and external clients while being disrespectful to those they work with every day. This inconsistency makes these behaviors even more memorable and egregious. Others have shared a different impact — the feeling of walking on eggshells at work, wondering who is going to show up: “smiling, charming, funny person” or “judgmental, intense, snapping person.” Over time, this drives passive aggressive responses from others in their attempt to avoid confrontation.
Ultimately, loyalty and followership are the two things we cannot demand or set as an expectation. What is perceived as fear-based motivation, belittlement, or power play can yield real short-term compliance from others. But negative behaviors ultimately diminish the legacy we leave. Consider what behaviors you might need to stop doing so that you can have a positive, lasting impact.
In: Operations Management
Amazing Manufacturing, Inc., has been considering the purchase of a new manufacturing facility for $510,000. The facility is to be fully depreciated on a straight-line basis over seven years. It is expected to have no resale value at that time. Operating revenues from the facility are expected to be $395,000, in nominal terms, at the end of the first year. The revenues are expected to increase at the inflation rate of 3 percent. Production costs at the end of the first year will be $240,000, in nominal terms, and they are expected to increase at 4 percent per year. The real discount rate is 6 percent. The corporate tax rate is 22 percent. |
Calculate the NPV of the project. |
In: Finance