Questions
•Modify p4.c so that the output file p4.output is created but also displayed to standard output...

•Modify p4.c so that the output file p4.output is created but also displayed to standard output ( the screen ). This should be done by another instance of exec().

•Implement the pipe() command to do the following:

$> grep –o else p4.c | wc –l

p4.c

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/wait.h>

int main(int argc, char *argv[]) {
int rc = fork();
if (rc < 0) {
    // fork failed
    fprintf(stderr, "fork failed\n");
    exit(1);
} else if (rc == 0) {
    // child: redirect standard output to a file
    close(STDOUT_FILENO);
    open("./p4.output", O_CREAT|O_WRONLY|O_TRUNC, S_IRWXU);

    // now exec "wc"...
    char *myargs[3];
    myargs[0] = strdup("wc");   // program: wc (word count)
    myargs[1] = strdup("p4.c"); // arg: file to count
    myargs[2] = NULL;           // mark end of array
    execvp(myargs[0], myargs); // runs word count
} else {
    // parent goes down this path (main)
    int rc_wait = wait(NULL);
}
return 0;
}

In: Computer Science

Starting out with Control Structures: Program challenges in C++ by Tony Gaddis This problem was adapted...

Starting out with Control Structures: Program challenges in C++ by Tony Gaddis

This problem was adapted from questions 9 and 10 on page 661

Write a program that keeps track of a speakers’ bureau. The program should use a structure to store the following data about a speaker:

Name, Telephone Number, Speaking Topic, Fee Required. The program should use a vector of structures. It should let the user enter data into the vector, change the contents of any element, and display all the data stored in the vector. The program should have a menu-driven user interface. Input Validation: When the data for a new speaker is entered, be sure the user enters data for all the fields. No negative amounts should be entered for a speaker’s fee.

In addition: add a function to the program that allows the user to search for a speaker on a particular topic. It should accept a key word as an argument then search the vector for a structure with that key word in the Speaking Topic field. All structures that match should be displayed. If no structure matches, a message saying so should be displayed. Hint: use the .find() string function to search the Speaking Topic field.

In: Computer Science

C++ Write a program that reads candidate names and numbers of votes in from a file....

C++

Write a program that reads candidate names and numbers of votes in from a file. You may assume that each candidate has a single word first name and a single word last name (although you do not have to make this assumption). Your program should read the candidates and the number of votes received into one or more dynamically allocated arrays.

In order to allocate the arrays you will need to know the number of records in the file. In order to determine the number of records in the file you may include the number as metadata in the first line of the file or you may read through the file to count the lines and then reset the file pointer back to the beginning of the file to read in the data. Do not hard code the number of candidates. Do not prompt the user to enter the number of candidates. You must either count the number of candidates in the file or encode the number as metadata as the first record in the file.

The program should output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. You may, but are not required to, use the example file provided.

In: Computer Science

Students will follow the hypothesis testing steps for each problem. They will compute the problem using...

Students will follow the hypothesis testing steps for each problem. They will compute the problem using the SPSS program. They will write the results in appropriate APA format and interpret the results. Steps of hypothesis testing will be typed out in a word document, as well as a copy and paste of the SPSS output.

For the following problems, you will:

  • Do all steps of hypothesis testing
    • Populations and hypotheses
    • Write out the steps you would do to calculate t
    • Choose the t-cutoff score
    • Calculate the t-statistic using the computer program SPSS
    • Write the t-statistic using proper APA format
    • Decide whether or not you would reject the null hypothesis
  • Interpret this result
  • Be sure to include a copy of the SPSS output in the word document
  1. Single Sample T-test

A researcher would like to study the effect of alcohol on reaction time. It is known that under regular circumstances the distribution of reaction times is normal with μ = 200. A sample of 10 subjects is obtained. Reaction time is measured for each individual after consumption of alcohol. Their reaction times were: 219, 221, 222, 222, 227, 228, 223, 230, 228, and 232. Use α = 0.05.

In: Math

Assignment Steps Note: the Social, Ethical, and Legal Implications assignment is part of the total marketing...

Assignment Steps

Note: the Social, Ethical, and Legal Implications assignment is part of the total marketing plan as outlined in the grading guide. It is not a separate paper.

Producing and marketing a product without regard to ethical, legal, and social considerations is detrimental to the overall success of any company.

Assess in a maximum of 700 words the ethical, legal, and social issues affecting your product or service in two markets: the United States and one international market. Domestic market generally means the market where the company headquarters are located. If you choose a domestic market that is not the U.S., then your other market is required to be the U.S. marketplace. This will be added to the Target Market section of your Marketing Plan.

Include the following:

Develop a process to monitor and control marketing performance. This process could be a flowchart but a flowchart is not required (flowcharts do not count towards your word count requirement).

Formulate a maximum 350-word executive summary including at a minimum the following elements to include in your marketing plan:

Required executive summary elements:

Strategic Objectives

Products or Services

Optional executive summary elements:

Resources Needed

Projected Outcomes

**PRODUCT IS COCA-COLA

In: Operations Management

take the paragraphs from the Module 1 assignment, find a relevant source about that and then...

take the paragraphs from the Module 1 assignment, find a relevant source about that and then add an in-text citation and a reference for the source.

There are a few ways that one may use plagiarism. One can use Plagiarize by submitting a assignment that they have already completed for a different course or by giving someone else their work to submit as their own. Plagiarize can also be caused if one do not use quotations where they are needed or cite references correctly. The best way to avoid plagiarize is by using accredited sources. It can be avoided by using resources provided by the University.

Conclusion

I agree they are a different type of the way you can use plagiarism. For example,

giving your paper to someone else and they use it in a class that you have had

prior to them and they resubmit it as their own. Then when you do an

assignment and you use other people word and not your own that is also

plagiarism. So, I agree that use the proper questions if using someone else

word in your assignment and giving the correct citations so that you do avoid

any university violations and you don’t have to do the research all over

again.

In: Operations Management

1. Write a program that does the following. Write in Assembly Language program Loads your student...

1. Write a program that does the following. Write in Assembly Language program

Loads your student ID number into memory starting at location 0x2000 0100 a. DO NOT do any conversion on your ID number. If my ID number is 123456789, I should be able to read your ID in memory as 123456789 2. Loads the first six characters of your name, in ASSIC, in to memory right after your student ID. Total of 6 bytes. a. This means that you should NOT over write anything that you have already entered. 3. Load from memory location 0x0000 0000 into the registers a. R0 and R1 hold the 64 bits starting at 0x0000 0000 (Total of 2 Words, each of 32 bits) b. R2 holds the next byte (8 bits) data c. R3 holds the next half word (16 bits) d. R4 holds the next word (32 bits) 4. Use the debugger to test your program to make sure that it does what you think it does. Use Lab 1 to help you get started with this

In: Computer Science

A new graduate nurse is working in a surgical ward of the local hospital. She has...

A new graduate nurse is working in a surgical ward of the local hospital. She has been allocated to care for Mrs Beverly Smith, a 70-year-old woman admitted for a hemicolectomy for stage 2 bowel cancer. Mrs Smith has a history of hypertension and stage 2 Chronic Kidney Disease (CKD). Mrs Smith had her surgery yesterday and is reported to have been stable overnight. She has a midline incision closed with staples, one Belovac of with minimal haemo-serous drainage, IV 4% Dextrose in 1/5 Normal Saline running at 85mL/hr and a PCA of Morphine sulphate 100mg in 100mL Normal Saline set to deliver 1mg with each press. She has an indwelling urinary catheter draining an average of 60mL/hr.

When the nurse assesses Mrs Smith at the beginning of the shift, she appears distressed and complains of pain rated 7 out of 10 in her abdominal area. Her observations are blood pressure 140/85 mmHg, pulse 90 bpm, respiratory rate 12, oxygen saturation 92% and temperature 36.2 degree Celsius. She is unwilling to sit up in bed and has difficulty taking a deep breath.   

The nurse explains to Mrs Smith the importance of pressing the PCA button regularly. She then checks her medication chart for any orders for “breakthrough” medication. Mrs Smith has an order for oxycodone (Endone) 10mg oral PRN, so the RN asks the endorsed EN to accompany her to the locked medication cupboard, check out the dose of Endone, and administer it to Mrs Smith, checking all the “5 rights” of medication administration.

The RN continues to give care to her other patients. When she returns to the room, she notes that Mrs Smith is sleeping peacefully. Because she had a poor night, she decides not to wake her for observations and charts “sleeping” on her PCA chart. The nurse then goes to morning tea.

When she returns from morning tea, she notes that Mrs Smith is slumped down in the bed and looks very pale. She does a set of observations and notes the following:

Patient is semi-conscious, rousing to voice, unable to give a pain score, PCA history delivered dose 15 times in the last 2 hours, blood pressure 90/60mmHg, pulse 70 bpm, respiratory rate 4 breaths per minute and shallow, oxygen saturation 84%.

Question 16. Maximum word limit 50 words. (1 mark) (Reference not required for this question)

Express the immediate priority patient problem indicated by this situation as a Nursing Diagnosis with a ‘Related to’ and ‘Evidenced by’ statement.

Question 17. Maximum word limit 200 words.

List four immediate priority nursing actions that are required in this situation to address the identified problem and a rationale for each.

Questions 18. Maximum word limit 200 words.

Discuss what you believe were the main patient factors and nursing or system errors, that led to this occurrence.

Question 19. Maximum word limit 150 words.

Following treatment by the medical and nursing team, Mrs Smith is significantly improved by the time her daughter visits later.

Describe the actions required following this incident as part of NSW Health and hospital policy to address issues of patient safety and standards of care.

Question 20. Maximum word limit 200 words.

What are the legal requirements for a Tort of negligence? Do you believe that the new graduate RN was negligent in this situation? Justify your answer.

In: Nursing

A new graduate nurse is working in a surgical ward of the local hospital. She has...

A new graduate nurse is working in a surgical ward of the local hospital. She has been allocated to care for Mrs Beverly Smith, a 70-year-old woman admitted for a hemicolectomy for stage 2 bowel cancer. Mrs Smith has a history of hypertension and stage 2 Chronic Kidney Disease (CKD). Mrs Smith had her surgery yesterday and is reported to have been stable overnight. She has a midline incision closed with staples, one Belovac of with minimal haemo-serous drainage, IV 4% Dextrose in 1/5 Normal Saline running at 85mL/hr and a PCA of Morphine sulphate 100mg in 100mL Normal Saline set to deliver 1mg with each press. She has an indwelling urinary catheter draining an average of 60mL/hr

When the nurse assesses Mrs Smith at the beginning of the shift, she appears distressed and complains of pain rated 7 out of 10 in her abdominal area. Her observations are blood pressure 140/85 mmHg, pulse 90 bpm, respiratory rate 12, oxygen saturation 92% and temperature 36.2 degree Celsius. She is unwilling to sit up in bed and has difficulty taking a deep breath.   

The nurse explains to Mrs Smith the importance of pressing the PCA button regularly. She then checks her medication chart for any orders for “breakthrough” medication. Mrs Smith has an order for oxycodone (Endone) 10mg oral PRN, so the RN asks the endorsed EN to accompany her to the locked medication cupboard, check out the dose of Endone, and administer it to Mrs Smith, checking all the “5 rights” of medication administration.

The RN continues to give care to her other patients. When she returns to the room, she notes that Mrs Smith is sleeping peacefully. Because she had a poor night, she decides not to wake her for observations and charts “sleeping” on her PCA chart. The nurse then goes to morning tea.

When she returns from morning tea, she notes that Mrs Smith is slumped down in the bed and looks very pale. She does a set of observations and notes the following:

Patient is semi-conscious, rousing to voice, unable to give a pain score, PCA history delivered dose 15 times in the last 2 hours, blood pressure 90/60mmHg, pulse 70 bpm, respiratory rate 4 breaths per minute and shallow, oxygen saturation 84%.

Question 16. Maximum word limit 50 words. (1 mark) (Reference not required for this question)

Express the immediate priority patient problem indicated by this situation as a Nursing Diagnosis with a ‘Related to’ and ‘Evidenced by’ statement.

Question 17. Maximum word limit 200 words.

List four immediate priority nursing actions that are required in this situation to address the identified problem and a rationale for each.

Questions 18. Maximum word limit 200 words.

Discuss what you believe were the main patient factors and nursing or system errors, that led to this occurrence.

Question 19. Maximum word limit 150 words.

Following treatment by the medical and nursing team, Mrs Smith is significantly improved by the time her daughter visits later.

Describe the actions required following this incident as part of NSW Health and hospital policy to address issues of patient safety and standards of care.

Question 20. Maximum word limit 200 words.

What are the legal requirements for a Tort of negligence? Do you believe that the new graduate RN was negligent in this situation? Justify your answer.

In: Nursing

Your task is to count the frequency of words in a text file, and return the...

Your task is to count the frequency of words in a text file, and return the most frequent word with its count.

For example, given the following text:

there are two ways of constructing a software design one way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.

Based on the example your program should printout the following along with the milliseconds to finish the computing:
The most frequent word is "there" with 3 occurrences.

The code is below, it doesn't seem to printout what word is the most frequent and how many occurrences of it there are.

import java.io.File;
import java.util.Scanner;
import java.util.Map.Entry;
import java.util.AbstractMap;
import java.util.LinkedList;

public class WordCountLinkedList254{

    public static Entry count_ARRAY(String[] tokens) {

        int CAPACITY = 10000;
        String[] words = new String[CAPACITY];
        int[] counts = new int[CAPACITY];

        for (int j = 0; j < tokens.length; j++) {
            String token = tokens[j];
            for (int i = 0; i < CAPACITY; i++) {
                if (words[i] == null) {
                    words[i] = token;
                    counts[i] = 1;
                    break;
                } else if (words[i].equals(token))
                    counts[i] = counts[i] + 1;
            }
        }
        int maxCount = 0;
        String maxWord = "";
        for (int i = 0; i < CAPACITY & words[i] != null; i++) {
            if (counts[i] > maxCount) {
                maxWord = words[i];
                maxCount = counts[i];
            }
        }
        return new AbstractMap.SimpleEntry < String, Integer > (maxWord, maxCount);
    }
  
   public static Entry count_LINKED_LIST(String[] tokens) {
        LinkedList> list = new LinkedList> ();
        for (int j = 0; j < tokens.length; j++) {
            String word = tokens[j];
            boolean found = false;

            /* for (int i = 0; i < list.size(); i++) {
            Entry e = list.get(i);
            if (word.equals(e.getKey())) {
            e.setValue(e.getValue() + 1);
            list.set(i, e);
            found = true;
            break;
               }
            }*/

            int i = 0;
            for (Entry e: list) {
                if (word.equals(e.getKey())) {
                    e.setValue(e.getValue() + 1);
                    list.set(i, e);
                    i++;
                    found = true;
                    break;
                }
            }

            if (!found)
                list.add(new AbstractMap.SimpleEntry (word, 1));
        }
        int maxCount = 0;
        String maxWord = "";
        for (int i = 0; i < list.size(); i++) {
            int count = list.get(i).getValue();
            if (count > maxCount) {
                maxWord = list.get(i).getKey();
                maxCount = count;
            }
        }
        return new AbstractMap.SimpleEntry < String, Integer > (maxWord, maxCount);
    }
  
    static String[] readText(String PATH) throws Exception {
        Scanner doc = new Scanner(new File(PATH)).useDelimiter("[^a-zA-Z]+");
        int length = 0;
        while (doc.hasNext()) {
            doc.next();
            length++;
        }
      
        String[] tokens = new String[length];
        Scanner s = new Scanner(new File(PATH)).useDelimiter("[^a-zA-Z]+");
        length = 0;
        while (s.hasNext()) {
            tokens[length] = s.next().toLowerCase();
            length++;
        }
        doc.close();
      
        return tokens;
    }
  
    public static void main(String[] args) throws Exception {
      
        String PATH = "/Users/jianguolu/Dropbox/254/code/dblp1k.txt ";
        String[] tokens = readText(PATH);
        long startTime = System.currentTimeMillis();
        Entry entry = count_LINKED_LIST(tokens);
        long endTime = System.currentTimeMillis();
        String time = String.format("%12d", endTime - startTime);
        System.out.println("time\t" + time + "\t" + entry.getKey() + ":" + entry.getValue());
      
        tokens = readText(PATH);
        startTime = System.currentTimeMillis();
        entry = count_ARRAY(tokens);
        endTime = System.currentTimeMillis();
        time = String.format("%12d", endTime - startTime);
        System.out.println("time\t" + time + "\t" + entry.getKey() + ":" + entry.getValue());
    }
}

In: Computer Science