Questions
Guidelines for the program: All methods listed below must be public and static. If your code...

Guidelines for the program:

  • All methods listed below must be public and static.
  • If your code is using a loop to modify or create a string, you need to use the StringBuilder class from the API.
  • Keep the loops simple but also efficient. Remember that you want each loop to do only one "task" while also avoiding unnecessary traversals of the data.
  • No additional methods are needed. However, you may write additional private helper methods, but you still need to have efficient and simple algorithms. Do not write helper methods that do a significant number of unnecessary traversals of the data.
  • Important: you must not use either break or continue in your code. These two commands are often used to compensate for a poorly designed loop. Likewise, you must not write code that mimics what break does. Instead, re-write your loop so that the loop logic does not need break-type behavior.
  • While it may be tempting to hunt through the API to find classes and methods that can shorten your code, you may not do that. The first reason is that this homework is an exercise in writing loops, not in using the API. The second reason is that in a lot of cases, the API methods may shorten the writing of your code but increase its running time. The only classes and methods you can use are listed below. Note: if a method you want to use from the API is not listed, you should not implement the method yourself so you can use it. Rather, you shoud look for the solution that does not need that method.

    You are allowed to use the following methods from the Java API:

    • class String
      • length
      • charAt
    • class StringBuilder
      • length
      • charAt
      • append
      • toString
    • class Character
      • any method

Create a class called HW2 that contains the following methods:

  1. replaceFirstK: takes a String, two chars, and an int as input and returns a String that is the same as the parameter String except that first int occurrences of the first char parameter are replaced with the second char parameter.

    > HW2.replaceFirstK("Mississippi River", 'i', 'I', 3)
    "MIssIssIppi River"
    > HW2.replaceFirstK("Missouri River", 'r', '*', 3)
    "Missou*i Rive*"
    
  2. allChars: takes two char parameters. Creates a String containing all characters, in order, from the first char parameter (inclusive) to the last (inclusive).

    > HW2.allChars('d', 'm')
    "defghijklm"
    
  3. showCharOfString: takes two String parameters. Outputs a new String that is the same as the first String except that: for each character of the first String, if the character is not in the second String, replace that character with the underscore ('_').

    > HW2.showCharOfString("Missouri River", "s SR!r")
    "__ss__r_ R___r"
    
  4. hangman: Takes a String and an int and returns a boolean. The method plays the game of hangman where the String is the word the player must guess and the int is the maximum number of "bad guesses" allowed. The game should work as follows:

    1. Creates a StringBuilder that stores all the letters guessed by the player. The StringBuilder should initially be empty.
    2. Has a loop that does the following:
      1. Calls the showCharOfString on the parameter String and a string containing all the guessed letters.
      2. Uses System.out.println to print the String returned from the previous step as well as the total number of "bad guesses" so far. (For fun, you can print a graphical hangman instead of the number of bad guesses.)
      3. Uses javax.swing.JOptionPane.showInputDialog to get the next guessed letter from the user. The method should not crash if the user does not enter appropriate data.
      4. If the letter has not yet been guessed, adds the letter to the StringBuilder containing the guessed letters and if the letter is not in the input String, increases the count of "bad guesses" by one.
    3. The loop repeats until either: all letters of the parameter String are guessed or the number of "bad guesses" equals the int parameter.
    Finally, the method returns true if the player guessed all the letters of the input String without reaching the limit on "bad guesses", and false if the "bad guesses" limit was reached. You should organize your loop so the return statement is after the loop terminates.
  5. hiddenString: takes an array of char and a String as input parameters and and returns an boolean. The method returns true if we can find the input string inside the array by starting at any position of the array and reading either forwards or backwards.

    > HW2.hiddenString(new char[]{'a','b','r','a','c','a','d','a'}, "acad")
    true
    > HW2.hiddenString(new char[]{'a','b','r','a','c','a','d','a'}, "carb")
    true
    > HW2.hiddenString(new char[]{'a','b','r','a','c','a','d','a'}, "brad")
    false
    
  6. hiddenString: takes a 2-dimensional array of char and a String as input parameters and returns a boolean. The method returns true if we can find the input string inside the array by starting at any position of the array and reading in any straight direction (up, down, left, right, or diagonal).

    > HW2.hiddenString(new char[][]{{'a', 'b', 'c'},{'r','c','a','d'},{'b','r'}}, "bcc")
    true
    > HW2.hiddenString(new char[][]{{'a', 'b', 'c'},{'r','c','a','d'},{'b','r'}}, "ace")
    false
    > HW2.hiddenString(new char[][]{{'a', 'b', 'c'},{'r','c','a','d'},{'b','r'}}, "cad")
    true
    
  7. Extra Credit (up to 10%)capitalizeWords takes a String as input and returns a String as output. Any word in the input string (a word is defined as a sequence of Enlish letters plus the hypen -) that contains any capitalized letter will have all its letters capitalized in the output string.

    > HW2.capitalizeWords("Guess what??  There are twenty-sIx letters in the English alphABEt!")
    "GUESS what??  THERE are TWENTY-SIX letters in the ENGLISH ALPHABET!"

In: Computer Science

Third Assignment Please read the following scenario and then refer to the materials of the courseto...

Third Assignment
Please read the following scenario and then refer to the materials of the courseto answer the questions
The scenario:
Dr. Latif is a new nephrologist employee working in the kidney dialysis unit at one of the Palestinian hospitals, and he deals with chronic patients who are visiting the unit "2 or 3" times weekly, so the staff is familiar with the patients and they formulated very close interaction and relationship.
He started to feel overinvolved with one of the patients who has many personal and family conflicts and she used to share it with Dr.Latif as he was very close to her, even they were friends on social media and he consider her to be a close friend, he felt empathetic with her, with time he started to be uncomfortable as the relationship started to cross the professional standers and he became emotional over-involvement.
Answer the following questions
1-Please, differentiate between the levels of patient-"Health care provider" like Doctor, Nurse…etc. involvement?
2-What communication skills should Dr. Latif follow to assure the professional relationship. And why?
3-Why do you think the patient-Doctor/Nurse relationship could become intimate ??reflect from the case
4- Please summarize in two lines how could the nurse be empathic with the patients but keep professional standers?
-You can submit the assignment either group"4-8" or individual work
-Use scientific accurate English language
-Use just Microsoft word document type
-Please do your efforts to express using your own language, don’t just copy and paste from internet sites, if you use reference mention them.

In: Nursing

In a business setting, we are often asked to write a memo to communicate with internal...

In a business setting, we are often asked to write a memo to communicate with internal and external professionals. To further advance your learning of memo communication, this written case requests that you prepare a memo to communicate within the company.

Background:

As the senior accountant at Technology on Demand (TOD), which manufactures mobile technology such as flip phones, smartphones, notebooks, and smartwatches, you are often asked to prepare various financial analysis necessary for decision making. Michelle Dodd, the controller, asked you to evaluate whether a piece of factory equipment should be replaced or kept. The old piece of factory equipment was purchased four years ago for $875,000. Over the last four years, TOD has allocated depreciation based on the straight-line method. The expected salvage value is $25,000. The current book value of the factory equipment is $425,000. The operating expenses total approximately $45,000 a year. It is estimated that the residual value (market value) of the old machine is $350,000. The controller is contemplating whether to replace the piece of factory equipment. The replacement factory equipment would consist of a purchase price of $500,000, a useful life of eight years, salvage value of 30,000, and annual operating costs of $35,000. In consideration of the background, prepare a memo in a Word document to submit to the controller. Your first paragraph would be an introduction paragraph of what the memo is about. Next, you will want to consider the equipment replacement decision. To add clarity to your discussion, you are to insert a table comparing the old equipment to the new equipment. In evaluating the “relevant” costs, what does your analysis show? Do you recommend that the equipment be replaced or kept ongoing for the next eight years? Why or why not?

In: Accounting

Medical Terminology AHS1001 The discussion assignment provides a forum for discussing relevant topics for this week...

Medical Terminology AHS1001

The discussion assignment provides a forum for discussing relevant topics for this week based on the course competencies covered.

Post your initial response to the Discussion Area by the due date assigned. To support your work, use your course text readings and also use outside sources. As with all assignments, cite your sources and provide references in APA format.

Start reviewing and responding to the postings of your classmates as early in the week as possible. Respond to at least two of your classmates. Participate in the discussion by providing a point of view with a rationale, challenging an aspect of the discussion, or indicating a relationship between two or more lines of reasoning in the discussion. Complete your participation for this assignment by the due date assigned.

Discussion:

Part One:

Using the directional terms in the table from your textbook, describe how you, or someone close by you, is sitting or standing. Include at least 5 of the terms describing body positioning and movement. Then describe the opposite (for example, if you said your foot was plantar flexed, use dorsiflexed) for all of the terms you used, and make a guess whether you would be comfortable in that position.

Your response should be posted to the Discussion Area below. By the end of the week, begin commenting on at least 2 of your peers' responses. Ask questions, further the discussion of the topic, reinforce a response, or add another dimension to the discussion. Always use constructive language.

Part Two

Think of a few examples or do some research into examples where the prefix or suffix of a root word changes the meaning from one term to another. Why is it critical for medical professionals to understand and use prefixes and suffixes carefully?

In: Nursing

Health Insurance and Economy When dealing with public health policy and laws, we need to consider...

Health Insurance and Economy

When dealing with public health policy and laws, we need to consider various aspects of the economy. Concepts of efficiency can be utilized when deciding which goods and services should be produced and who should receive them.

The three types of efficiencies are allocative, production, and technical. The two types of health economics are positive and normative. Positive Economics deals with "what is" or the current status that is linked to a clear standard of measurement. Normative economics deals with "what ought to be" and is subject to interpretation with the moral or ethical aspects of a policy. Your lecture has more details.

Using South University Online Library or the Internet, search the article, “The Interplay of Public Health Law and Industry Self-Regulation: The Case of Sugar-Sweetened Beverage Sales in Schools."

On the basis of the article and your understanding on the topic, write a 3- to 4-page essay in a Microsoft Word document on the three types of economic efficiencies and both positive and normative economics as it relates to regulating sugar-sweetened beverage sales in schools.

Support your statements with at least two other scholarly sources, correctly formatted in APA style. This assignment requires a title page, an introduction, a body, a conclusion, and a separate reference page.

Submission Details:

Support your responses with reasoning and examples.

Cite any sources in APA format.

Name your document SU_PHE3050_W2_A2_LastName_FirstInitial.doc.

Submit your document to the Submissions Area by the due date assigned.

Reference:

Mello, M. M., Pomeranz, J., & Moran, P. (2008). The interplay of public health law and industry self-regulation: The case of sugar-sweetened beverage sales in schools. American Journal of Public Health, 98(4). 595–604.

In: Nursing

Fact Pattern #1: Pat contracts with an Ajax Insurance Company agent for a $50,000 ordinary life...

Fact Pattern #1:

Pat contracts with an Ajax Insurance Company agent for a $50,000 ordinary life insurance policy. The application form is filled in to show Pat's age as 32. In addition, the application form asks whether Pat has ever had any heart ailments or problems. Pat answers no, forgetting that as a young child he was diagnosed as having a slight heart murmur. A policy is issued. Three years later, Pat becomes seriously ill and dies. A review of the policy discloses that Pat was actually 33 at the time of the application and the issuance of the policy and that he incorrectly answered the question about the history of heart ailments.

Fact Pattern #2:

Best Insurance Company provides Eve Erickson with property insurance that contains an 80% coinsurance clause. The coinsurance clause states that if Eve insures the property up to 80% of its value, she will recover any loss up to the face amount of the policy. Eve purchases an $80,000 property insurance policy for property valued at $200,000. Due to a fire, Eve suffers a loss of $10,000.

Adapted from Business Law, 114h Edition, by Clarkson, Miller, Jentz and Cross, (2016).

Questions

Answer the following questions in a Word document and submit it by the due date.

  1. In Fact Pattern #1, can Ajax void the policy and escape liability on Pat's death? Why or why not? Explain.
  2. In Fact Pattern #1, if there was any ambiguity on the application, should it be resolved in favor of the insured or the insurer? Explain.
  3. In Fact Pattern #2, what dollar amount will Eve recover from the insurance company? Explain and show your calculation of Eve's insurance recovery.
  4. What are the advantages and disadvantages of an incontestability clause? Explain.

In: Operations Management

Nonparametric Methods In this assignment, we will use the following nonparametric methods: The Wilcoxon signed-rank test:...

Nonparametric Methods
In this assignment, we will use the following nonparametric methods:

  • The Wilcoxon signed-rank test: The Wilcoxon signed-rank test is the nonparametric test analog of the paired t-test.
  • The Wilcoxon rank-sum test or the Mann-Whitney U test: The Wilcoxon rank-sum test is an analog to the two-sample t-test for independent samples.

Part 1: Wilcoxon Signed-Rank Test

Let's take a hypothetical situation. The World Health Organization (WHO) wants to investigate whether building irrigation systems in an African region helped reduce the number of new cases of malaria and increased the public health level.

Data was collected for the following variables from ten different cities of Africa:

  • The number of new cases of malaria before the irrigation systems were built
  • The number of new cases of malaria after the irrigation systems were built

Table 1: Cases of Malaria

City Before After
1 110 55
2 240 75
3 68 15
4 100 10
5 120 21
6 110 11
7 141 41
8 113 5
9 112 13
10 110 8

Using the Minitab statistical analysis program to enter the data and perform the analysis, complete the following:

  • Run a sample Wilcoxon signed-rank test to show whether there is a statistically significant difference between the number of cases before and after the irrigation systems were built.
  • Obtain the rank-sum.
  • Determine the significance of the difference between the groups.
  • Determine whether building these systems helped reduce new cases of malaria.
  • In a Microsoft Word document, provide a written interpretation of your results.

In: Statistics and Probability

1. Dr. Woz and Dr. Yaz want to test whether violent video games have an effect...

1. Dr. Woz and Dr. Yaz want to test whether violent video games have an effect on aggressive thinking. In order to test aggressive thinking, Woz and Yaz are going to use a test developed at GTA University; scores greater than 70 on the test indicate agreement with statements that endorse aggressive behavior. They select a sample of n = 100 teenagers from a local high school for the study. Each of the students spends an hour playing a first-person shooter video game and then takes the test. The mean and standard deviation for the sample is M = 73 and s = 20. Woz and Yaz would like to know if the sample mean of 73 is statistically significantly different from 70 using a two-tailed test with ? < .05 and critical values of t of ±1.98.

a. What is the null hypothesis for this test? H0 =

b. What is the estimated standard error for this test?

c. Calculate the value of t (round to two decimal places, if rounding is necessary).

d. Do you accept or reject the null hypothesis?

2. A paired samples t-test produces the following results: t(99) = 2.15, p < .05. The study included 1 blank participants and the decision was to 2 blank the null hypothesis. (Note: Your first answer will be a number and your second will be a word.)

3. The estimated standard error:

a.

provides an estimated measure of how much difference you can expect to see between an individual's score and the sample mean due to sampling error.

b.

gives us no useful information.

c.

is equal to the population mean.

d.

provides an estimated measure of how much difference you can expect to see between a sample mean and the mean of the population due to sampling error

In: Statistics and Probability

Gold-I-Locks plc manufactures and sells doors and windows that contain a revolutionary locking mechanism the CEO...

Gold-I-Locks plc manufactures and sells doors and windows that contain a revolutionary locking mechanism the CEO developed while at university.  You have been provided with the company’s trial balance as at 31 March 2020.  Unfortunately, it was prepared by a junior member of staff and does NOT balance.  

Gold-I-Locks plc

Trial Balance

As at 31 March 2020

£

£

Equity shares

100,000

8% debentures

50,000

Share premium

9,500

Retained profits

12,976

Motor vehicles (cost)

210,000

Accumulated depreciation

19,000

Inventories

14,167

Accounts receivable

11,000

Accounts payable

8,336

Bank

10,906

Sales

270,620

Purchases

186,000

Wages

33,502

Electricity expenses

350

Rent expenses2

2,218

General expenses

1,112

Debenture interest

4,000

The junior member of staff has identified the following errors but does not know how to correct them:

  1. A payment of £150 for electricity was entered in the Bank Account but was not recorded in the Electricity Expense Account.
  2. There is a debit in the Rent Expense Account for £718 and a debit to the bank account for the same amount.
  3. A sale for £1,200 has been entered correctly in Accounts Receivable but as £120 in the Sales Account.
  4. A payment to a supplier of £457 has been correctly recorded in Accounts Payable Account but no other entry has been made.

Required:

  1. Prepare journal entries to correct the above errors and prepare a T-account for the Suspense Account showing the entries.

[20 marks]

  1. There are two general categories of errors: Those that cause the trial balance not to balance and those that do not affect the trial balance balancing.  Describe one of each type of error, provide an example and describe how you would correct it. [word limit: 100-200 words]

In: Accounting

test the hypothesis (α = 0.05) that the population proportions of red and brown are equal...

test the hypothesis (α = 0.05) that the population proportions of red and brown are equal (pred = pbrown). You are testing if their proportions are equal to one another. NOTE: These are NOT independent samples, but we will use this approach anyway to practice the method. This also means that n1 and n2 will both be the total number of candies in all the bags. The “x” values for red and brown are the counts of each we found on the Data page. You will need to calculate the weighted p: Be sure to state clear hypotheses, test statistic, critical value or p-value, decision (reject/fail to reject), and conclusion in English. Submit your answer as a Word, Excel, .rtf or .pdf format through the M&M® project link in the weekly course content. HELP You can use your TI to help with this test. Needed information for both tools include: x1 = number of red n1 = total number of candies x2 = number of brown n2 = total number of candies

Candies per bag Blue candies Green candies Orange candies Yellow Candies Brown Candies Red Candies
Bag 1 55 11 11 13 12 4 4
Bag 2 57 11 13 13 10 2 8
Bag 3 58 13 14 7 13 3 8
n 3 3 3 3 3 3 3
average 56.66666667 11.66666667 12.66666667 11 9.5 3 5.75
stanard deviation 1.527525232 1.154700538 1.527525232 3.464101615 1.527525232 1 2.309401077
95% confidence inteval 3.794583034 2.868435153 3.794583034 8.605305459 3.794583034 2.484137712 5.736870306

In: Statistics and Probability