I need the following C code converted to java or C++
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
struct node *left;
struct node *right;
long data;
long leftSize;
} node;
void btreeInsert(node *new, node **rootptr) {
node *parent = NULL, *cursor;
/* Find parent */
cursor = *rootptr;
while (cursor != NULL) {
parent = cursor;
if (new->data < cursor->data) {
cursor->leftSize += 1;
cursor = cursor->left;
} else {
cursor = cursor->right;
}
}
/* Insert node below parent */
if (parent == NULL) {
*rootptr = new;
} else if (new->data < parent->data) {
parent->left = new;
} else {
parent->right = new;
}
}
node *readTree(FILE *dataFile) {
node *root = NULL, *new;
long element;
while (fscanf(dataFile, "%ld\n", &element) == 1) {
new = malloc(sizeof(node));
new->data = element;
new->right = NULL;
new->left = NULL;
new->leftSize = 0;
btreeInsert(new, &root);
}
return root;
}
long kthOrder(int k, node *root) {
node *current;
current = root;
while (k != current->leftSize + 1) {
if (k <= current->leftSize) {
current = current->left;
} else {
k -= current->leftSize + 1;
current = current->right;
}
}
return current->data;
}
void reportKthOrderStats(FILE *positionFile, node *root) {
int position;
while (fscanf(positionFile, "%i\n", &position) == 1) {
printf("%ld\n", kthOrder(position, root));
}
}
int main(int argc, const char * argv[]) {
const char *data, *range;
FILE *dataFile, *rangeFile;
node *root;
data = argv[1];
range = argv[2];
dataFile = fopen(data, "r");
rangeFile = fopen(range, "r");
root = readTree(dataFile);
reportKthOrderStats(rangeFile, root);
return (0);
}
In: Computer Science
ARAB CASE STUDY
Mrs. Ayesha Said is a 39-year-old Muslim Arab housewife and mother of six who immigrated to the United States from a rural town in southern Iraq 2 years ago. Her mother-in-law and her husband, Mr. Ahmed Said, accompanied her to the United States as participants in a post–Gulf War resettlement program, after they spent some time in a Saudi Arabian refugee camp. Their relocation was coordinated by a local international institution that provided an array of services for finding employment, establishing a household, enrolling the children in public schools, and applying for federal aid programs.
Mr. Ahmed, who completed the equivalent of high school, works in a local plastics factory. He speaks some English. He plans to attend an English-language class held at the factory for its many Iraqi employees. Mrs. Ayesha, who has very little formal schooling, spends her day cooking and caring for her children and spouse, with the assistance of her mother-in-law. She leaves their home, a three-bedroom upper flat in a poor area of the city, only when she accompanies her husband shopping or when they attend gatherings at the local Islamic center. These events are quite enjoyable because most of those using the center are also recently arrived Iraqi immigrants. She also socializes with other Iraqi women by telephone. Except for interactions with the American personnel at the institute, Mr. Ahmed and Mrs. Ayesha Said remain quite isolated from American society. They have discussed moving to Detroit because of its large Arab community.
Four of the Said children attend public elementary schools, participating in the English as a Second Language (ESL) program. Mr. Ahmed and Mrs. Ayesha are dismayed by their children’s rapid acculturation. Although Muslims do not practice holidays such as Halloween, Christmas, Valentine’s Day, and Easter, their children plead to participate in these school-related activities.
Mrs. Ayesha is being admitted to the surgical unit after a modified radical mastectomy. According to the physician’s notes, she discovered a “lump that didn’t go away” about 6 months ago while breast-feeding her youngest child. She delayed seeking care, hoping thatinshallah, the lump would vanish. Access to care was also limited by Mrs. Ayesha’s preference for a female physician and her family’s financial constraints—that is, finding a female surgeon willing to treat a patient with limited financial means. Her past medical history includes measles, dental problems, headache, and a reproductive history of seven pregnancies. One child, born prematurely, died soon after birth. As you enter the room, you see Mrs. Ayesha dozing. Her husband, mother-in-law, and a family friend, who speaks English and Arabic and acts as the translator, are at her bedside.
Study Questions
1.Describe Arab Americans with respect to religion, education, occupation, income, and English-language skills. Compare the Said family with Arab Americans as a group.
2.Assess the Said family’s risk for experiencing a stressful immigration related to their isolated lifestyle.
3.Describe the steps you would take to develop rapport with Mrs. Ayesha and her family during your initial encounter. Include nonverbal behavior and social etiquette as well as statements or questions that might block communication.
4.Identify interventions that you would employ to accommodate Mrs. Ayesha’s “shyness” and modesty.
5.You notice that, although Mrs. Ayesha is alert, her husband and sometimes her mother-in-law reply to your questions. Interpret this behavior within a cultural context.
6.Although Mrs. Ayesha is normothermic and states her pain is “little,” Mr. Ahmed insists that his wife be covered with several additional blankets and receive an injection for pain. When you attempt to reassure him of his wife’s satisfactory recovery, noting as evidence of her stable condition that you plan to “get her up” that evening, he demands to see the physician. Interpret his behavior within a cultural context.
7.Discuss Arab food preferences as well as the dietary restrictions of practicing Muslims. If you filled out Mrs. Ayesha’s menu, what would you order?
8.When you give Mrs. Ayesha and her family members discharge instructions, what teaching methods would be most effective? What content regarding recovery from a mastectomy might most Arab Americans consider “too personal”?
9.Identify typical coping strategies of Arabs. What could you do to facilitate Mrs. Ayesha’s use of these strategies?
10.Discuss predestination as it influences the Arab American’s responses to death and bereavement.
11.Discuss Islamic rulings regarding the following health matters: contraception, abortion, infertility treatment, autopsy, and organ donation and transplant.
12.Describe the Arab American’s culturally based role expectations for nurses and physicians. In what ways do the role responsibilities of Arab and American nurses differ?
13.What illnesses or conditions are Arab Americans unlikely to disclose because of Islamic prohibitions or an attached stigma?
14.Compile a health profile (strengths versus challenges) of Arab Americans by comparing beliefs, values, behaviors, and practices favoring health and those negatively influencing health.
In: Nursing
QUESTION #1: Demolition at the construction site accident
A 42 year-old man is admitted to the emergency room having been in an accident involving a construction site and dynamite. The patient was brought to the hospital and it was explained that a detonation they were working on went off too soon and the worker was thrown to the ground. The patient was seen drinking plenty of water throughout the day.
The 42 year-old is conscious, blood pressure is slightly high, her pulse is strong but rapid. The patient is breathing normally. The patient is evidently embarrassed by the events. A nurse asks the patient to describe what happened and these are the symptoms that are noticed as the patient tries to explain the events:
The patient’s reflexes are checked, including the ability to touch his nose with his eyes closed. His reflexes are normal; however he is unable to touch his nose with his eyes closed. His movements seem uncoordinated.
As the examination continues, the nurse discovers the following:
The nurse believes that the patient has suffered some minor injuries, and the nurse suspects that the patient most likely has a concussion.
answer the following questions:
QUESTION #2:
Increased need to urinate while swimming.
A friend of yours has twin 5 year old girls and loves to take them to the pool. You friend tells you, however that the most annoying thing is that although the girls are asked to pee before going into the pool, they generally say they don't have to pee, just to ask to go pee 5 minutes after being in the pool! "What's up with that?!" your friend asks, "Could there be something wrong with the girls, are they just being mischievous? Do you think I should take them to the doctor to see if there is a problem with their bladders? It only ever happens when they go into the pool". As a physiology student, apply your knowledge to explain why the girls tend to have to pee when they go swimming.
Question 1) Using your knowledge of physiology and circulation, how does the body respond if it gets cold, as would be the case during swimming?
Question 2) Now that we know where blood is being directed when the body gets cold, how does that affect the following?
Questions 3) How do the kidneys respond to the changes that can occur in blood pressure, cardiac output, ANS, Osmoreceptor, Posterior Pituitary and ADH, as noted in the previous questions?
Question 4) Now that you have applied your knowledge, what can you tell your friend about their question? Is there something wrong? (Yes or no). What is your diagnosis?
QUESTION#3:
Reproduction Case Study -
A 33 year old woman and her 32 year old husband have been trying to have a baby for over a year. Unfortunately, they have not yet been able to conceive. The woman has been tracking her cycle and does not have a regular 28 day cycle. Both husband and wife are somewhat healthy, non-smokers and occasional drinker, although the women has given up drinking since they have started trying for a baby.
Success! The couple is pregnant.
PLEASE ANSWER ALL OF THE ABOVE (physiology)
In: Anatomy and Physiology
Read the input one line at a time until you have read all lines. Now output these lines in the opposite order from which they were read..
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Part12 {
/**
* Your code goes here - see Part0 for an example
* @param r the reader to read from
* @param w the writer to write to
* @throws IOException
*/
public static void doIt(BufferedReader r, PrintWriter
w) throws IOException {
// Your code goes here - see Part0
for an example
}
/**
* The driver. Open a BufferedReader and a PrintWriter,
either from System.in
* and System.out or from filenames specified on the
command line, then call doIt.
* @param args
*/
public static void main(String[] args) {
try {
BufferedReader
r;
PrintWriter
w;
if (args.length
== 0) {
r = new BufferedReader(new
InputStreamReader(System.in));
w = new PrintWriter(System.out);
} else if
(args.length == 1) {
r = new BufferedReader(new
FileReader(args[0]));
w = new PrintWriter(System.out);
} else {
r = new BufferedReader(new
FileReader(args[0]));
w = new PrintWriter(new
FileWriter(args[1]));
}
long start =
System.nanoTime();
doIt(r,
w);
w.flush();
long stop =
System.nanoTime();
System.out.println("Execution time: " + 1e-9 * (stop-start));
} catch (IOException e) {
System.err.println(e);
System.exit(-1);
}
}
}
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class Part0 {
/**
* Read lines one at a time from r. After reading all
lines, output
* all lines to w, outputting duplicate lines only
once. Note: the order
* of the output is unspecified and may have nothing to
do with the order
* that lines appear in r.
* @param r the reader to read from
* @param w the writer to write to
* @throws IOException
*/
public static void doIt(BufferedReader r, PrintWriter
w) throws IOException {
Set<String> s = new HashSet<>();
for (String line = r.readLine(); line != null; line =
r.readLine()) {
s.add(line);
}
for (String text : s) {
w.println(text);
}
}
/**
* The driver. Open a BufferedReader and a PrintWriter,
either from System.in
* and System.out or from filenames specified on the
command line, then call doIt.
* @param args
*/
public static void main(String[] args) {
try {
BufferedReader
r;
PrintWriter
w;
if (args.length
== 0) {
r = new BufferedReader(new
InputStreamReader(System.in));
w = new PrintWriter(System.out);
} else if
(args.length == 1) {
r = new BufferedReader(new
FileReader(args[0]));
w = new PrintWriter(System.out);
} else {
r = new BufferedReader(new
FileReader(args[0]));
w = new PrintWriter(new
FileWriter(args[1]));
}
long start =
System.nanoTime();
doIt(r,
w);
w.flush();
long stop =
System.nanoTime();
System.out.println("Execution time: " + 1e-9 * (stop-start));
} catch (IOException e) {
System.err.println(e);
System.exit(-1);
}
}
}
In: Computer Science
Draw an indifference curve that is tangent to the new budget constraint, and label the worker’s new choice of labor/leisure, and new total earnings, at a point that appears reasonable given convex preferences.
In: Economics
Garbage collector works in following condition:
1.
Employee john = new Employee()
john=null;
2.
Employee c1 =new Employee()
Employee c2 = new Employee()
c1=c2;
3.
new Employee(); //anonymous object
Please create a class /classes in java which contains examples related to above 3 conditons.
In: Computer Science
|
Case Study |
CEMEX: A Model Multinational from an Unusual Place |
|
Our discussion in the text stresses that multinationals succeed by using their firm-specific advantages throughout their global operations. We have also noted that most foreign direct investments are made by firms based in the industrialized countries. This is the story of CEMEX, a firm that rapidly has become multinational since 1990. The reasons for its multinational success fit very well with the advantages stressed in the eclectic approach. What makes the firm unusual is that it is based in Mexico. CEMEX is an example of a growing group of multinationals based in developing countries.
CEMEX began business in 1906. For most of its life this cement company focused on selling in the Mexican market. Cement is a product that is expensive to ship, especially overland, so cement plants ship mostly to customers within 300 miles of a plant. Shipment by water is moderately (but not prohibitively) expensive. Most cement producers in the 1980s were local producers with traditional business practices. New managers at CEMEX broke with tradition by introducing extensive use of automation, information technology, and a satellite-based communication network into CEMEX operations. They used the technology to improve quality control and to provide detailed information on production, sales, and distribution to top managers in real time. Delivery of ready-mix concrete is particularly challenging in cities. Traditionally, cement firms could ensure delivery only within a time period of about three hours. CEMEX pioneered the use of computers and a global positioning system to guarantee delivery to construction sites within a 20-minute window. These innovations became the company's firm-specific advantages.
Also in the 1980s CEMEX began to export more aggressively to the United States using sea transport, and it was increasingly successful. However, competing U.S. cement producers complained to the U.S. government, and in 1990 CEMEX exports to the United States were hit by a 58 percent antidumping duty. With exporting to the United States limited by the antidumping order, CEMEX looked for other foreign opportunities.
In 1991, it began exporting to Spain, and in 1992 it made its first foreign direct investment by acquiring two Spanish cement producers. CEMEX minimized its inherent disadvantages by investing first in a foreign country with the same language as the firm's home country and a similar culture. In addition, CEMEX used its expansion into Europe as a competitive response to the previous move by the Swiss-based firm Holcim into the Mexican cement industry.
The management team sent by CEMEX to reorganize the acquired companies was amazed to find companies that kept handwritten records and used almost no personal computers. They upgraded the Spanish affiliates to CEMEX technology and management practices. The improvement in affiliate operations from this internal transfer of CEMEX's intangible assets was remarkable—profit margins improved from 7 percent to 24 percent in two years.
Since then, CEMEX has made a series of foreign direct investments by acquiring cement producers in Latin America (including Venezuela, Panama, the Dominican Republic, Colombia, and Costa Rica), the United States, Britain, the Philippines, Indonesia, and Egypt. CEMEX used the same type of process that it used in Spain to bring its technology and management practices into its new foreign affiliates, and generally achieved similarly impressive improvements in performance.
By 2000, CEMEX was the third largest cement producer in the world, behind Lafarge of France and Holcim. More than 60 percent of its physical assets were in its foreign affiliates. It was also the largest exporter of cement in the world (a fact consistent with the proposition discussed in the text that FDI and trade are often complementary). CEMEX is considered one of the best networked companies globally by computer industry experts, well ahead of its rivals. Its investments in developing and enhancing its firm-specific advantages have been paying off globally.
CEMEX is a great example of a domestic firm becoming a multi-national giant by a clever interplay of technology, foreign direct investment and innovation. Please spell out the experience of another company in a different industry that had similar success. For all of his success, what can Cemex learn from your company?
In: Economics
In: Accounting
You have been appointed as the new management accountant to manage the transition of the existing Adelaide Royal Hospital to the proposed new site at Bukit Merah. The hospital has several separate departments responsible for direct patient care. Such as Accident and Emergency, Intensive Care, Neurology, and Cardiology, as well as several support departments such as Radiology and Patient Records. You are a little uncertain as to what your role will be in the new hospital, as consultants have been engaged to design the new management accounting systems. You thought that as a management accountant you would be responsible for developing a new system!
Required
(a). Write a report to senior management explaining how you, as the management accountant, may contribute to the design and operation of the new management accounting systems for the new hospital.
(b). Outline the types of management accounting information that you believe senior managers may require on a regular basis (i.e., weekly and monthly) to manage the operations of the new hospital. Consider both financial and nonfinancial information
In: Accounting
Urban Economics- Urban Labor Market: Employment and Wage
Q1-Q2 are based on the following conditions.
1) Consider the effect of a natural disaster on an urban economy. In the initial equilibrium, total employment in the city is 100,000 workers and weekly wage rate is $1000. The price elasticity of supply of labor is 3.0 and the price elasticity of demand for labor is -2.
Suppose a typhoon reduces labor supply (a horizontal shift of the supply curve) by 10,000 workers immediately after the disaster. Which of the following statements is correct?
a) The new equilibrium weekly wage is $1,040.
b) The new equilibrium weekly wage is $980
c) The new equilibrium employment is 96,000
d) The new equilibrium employment is 104,000
2) Suppose the typhoon not only reduces labor supply but also decreases the labor demand by 10,000 workers. Which of the following statements is correct?
a) The new equilibrium weekly wage is $1000
b) The new equilibrium weekly wage is $980
c) The new equilibrium employment is 94,000
d) The new equilibrium employment is 88,000
In: Economics