Leather Ltd has been in business for many years making hand-made, high end, leather goods. One of its products is a designer jacket. There are two divisions involved in the production of jackets, the Cutting Centre and the Stitching Division. Budgeted production for both divisions is 500 jackets per year. The Cutting Centre specialises in cutting out the unique designs and currently only supplies to the Stitching Division, which expertly hand stitches the product to make a jacket of exceptional quality. The Stitching Division then sells the product to exclusive clients for £3,500 per jacket. The Cutting Centre incurs variable costs of £1,800 per jacket and fixed overheads of £100,000. The Stitching Division incurs further variable processing costs of £900 per jacket and fixed overheads of £50,000.
Required: (b) Calculate the budgeted annual profit for each division and the company as a whole if the cut leather is transferred to the Stitching Division at transfer price of £2,000.
(c) Assuming divisional performance is measured based on profit, discuss and explain the likely reaction of the divisional managers to an imposed transfer price of £2,000. (maximum word count 100 words)
(d) It has now come to light that the Cutting Centre could sell 300 units of cut designs to an external customer for £3,000 per unit. Discuss the effect that this will have on Leather Ltd’s profits and the willingness of each divisional manager to accept an imposed transfer price of £2,000 in each of the following scenarios separately: Scenario 1: The Cutting Centre capacity is sufficient to supply both the external customer and the Stitching Division. Scenario 2: A restricted supply of skilled labour means that the Cutting Centre has a maximum production capacity of 500 units.
Use calculations to support your answer. (maximum word count 120 words)
(e) If the Cutting Centre’s demand from external customers grows until it reaches a point where it is working at maximum capacity supplying goods to external customers at £3,000 a unit, calculate and explain the minimum transfer price that the Cutting Centre would charge, assuming other costs remain the same. (maximum word count 60 words)
In: Accounting
Problem 1 - Find the Diphthongs
A diphthong is a composite vowel sound composed of two simple vowel sounds. We're going to be looking for these in words. For instance "ay" is normally a diphthong for instance in the words "lay" and "day", as is "ou" for instance in "loud," "lout."
We're going to simplify this by looking only for two vowels in a row in a word regardless of whether they are sounded out as diphthongs or not.
Let me show some examples of the counting:
[Ae]rat[io]n; count = 2
F[ou]ndat[io]n; count = 2
Q[ue][ue]ing; count = 2
The reason that we are counting this as two, is because once we've used a vowel as part of a diphthong do not use it again.
Note also that after the last pair, there's another vowel, but since the last e was used, the i doesn't pair, so it is not part of a diphthong.
P[ae]an; count = 1
Several; count = 0
[Ae][ae][ae][ae][ae]; count = 5
This is obviously an invented word, but who cares, it's composed of five diphthong pairs.
Glor[ia]; count = 1
For this exercise, the vowels are a, e, i, o, u, and y.
Take in a word, output each diphthong pair and finally output the count.
In terms of spaces, commas, and periods, let the words be divided, so don't count a dipthong over a space or other grammatical mark, meaning that for instance "a year" should group like "a [ye]ar" rather than "[a y][ea]r."
Sample Output
|
linux1[150]% python3 find_diphthongs.py Enter a string with a lot of diphthongs: aeration ae io The diphthong count is 2 linux1[151]% python3 find_diphthongs.py Enter a string with a lot of diphthongs: aeitiour ae io The diphthong count is 2 linux1[152]% python3 find_diphthongs.py Enter a string with a lot of diphthongs: ayayay ay ay ay The diphthong count is 3 linux1[153]% python3 find_diphthongs.py Enter a string with a lot of diphthongs: argument The diphthong count is 0 |
If you want to eliminate a space between your letters and you're printing the characters separately, use:
print('a', 'e', sep='')
In: Computer Science
DIRECTION: Create an NCP in relation to the case scenario.
Case Scenario: This is a case of a patient referred to a specialty memory clinic at the age of 62 with a 2-year history of repetitiveness, memory loss, and executive function loss. Magnetic resonance imaging scan at age 58 revealed mild generalized cortical atrophy. He is white with 2 years of postsecondary education. Retirement at age 57 from employment as a manager in telecommunications company was because family finances allowed and not because of cognitive challenges with work. Progressive cognitive decline was evident by the report of deficits in instrumental activities of daily living performance over the past 9 months before his initial consultation in the memory clinic. Word finding and literacy skills were noted to have deteriorated in the preceding 6 months according to his spouse. Examples of functional losses were being slower in processing and carrying out instructions, not knowing how to turn off the stove, and becoming unable to assist in boat docking which was the couple’s pastime. He stopped driving a motor vehicle about 6 months before his memory clinic consultation. His past medical history was relevant for hypercholesterolemia and vitamin D deficiency. He had no surgical history. He had no history of smoking, alcohol, or other drug misuse. Laboratory screening was normal. There was no first-degree family history of presenile dementia. Neurocognitive assessment at the first clinic visit revealed a poor verbal fluency (patient was able to produce only 5 animal names and 1 F-word in 1 min) as well as poor visuospatial and executive skills. He had fluent speech without semantic deficits. His neurological examination was pertinent for normal muscle tone and power, mild ideomotor apraxia on performing commands for motor tasks with no suggestion of cerebellar dysfunction, normal gait, no frontal release signs. His speech was fluent with obvious word finding difficulties but with no phonemic or semantic paraphrasic errors. His general physical examination was unremarkable without evidence of presenile cataracts. He had normal hearing. There was no evidence of depression or psychotic symptoms.
In: Nursing
Using python
what is needed to be added or changed
Problem 1:
The program has three functions in it.
I want you to complete the count_how_many_words() function, and then call it (multiple times) inside main() to find out how many times Poe used the word “Raven” (or “raven”) and how many times he used “Nevermore” (or “nevermore”) inside the poem “The Raven.” You may not use list.count().
Don’t add any global variables or constants (besides the one I’ve declared, which could be moved into main() but would be even uglier there).
Example output (with incorrect numbers):
The word "Raven" (or "raven") appears 42 times in Edgar Allen Poe's "The Raven."
The word "Nevermore" (or "nevermore") appears 48 times in Edgar Allen Poe's "The Raven."
# this is what quick-and-dirty data cleaning looks like, friends
def break_into_list_of_words(string):
"""takes a long string and returns a list of all of the words in the string"""
# vvv YOU DO NOT HAVE TO CHANGE ANYTHING IN HERE vvv
list_of_words = []
# break by newlines to get a list of lines
list_of_lines = string.split('\n')
# remove the empty lines
while '' in list_of_lines:
list_of_lines.remove('')
# split the line up
for line in list_of_lines:
# we have a few words run together with dashes
# this breaks the line up by dashes (non-ideal, but eh)
maybe_broken_line = line.split('—')
# now we will take the line that might be split, and we'll split again
# but this time on spaces
for a_line in maybe_broken_line:
list_of_words = list_of_words + a_line.split(' ')
# if blank spaces crept in (they did), let's get rid of them
while ' ' in list_of_words:
list_of_words.remove(' ')
while '' in list_of_words:
list_of_words.remove('')
# removing a lot of unnecessary punctuation; gives you more options
# for how to solve this problem
# (you'll get a cleaner way to do this, later in the semester, too)
for index in range(0, len(list_of_words)):
list_of_words[index] = list_of_words[index].strip(";")
list_of_words[index] = list_of_words[index].strip("?")
list_of_words[index] = list_of_words[index].strip(".")
list_of_words[index] = list_of_words[index].strip(",")
list_of_words[index] = list_of_words[index].strip("!")
# smart quotes will ruin your LIFE
list_of_words[index] = list_of_words[index].strip("“")
list_of_words[index] = list_of_words[index].strip("”")
list_of_words[index] = list_of_words[index].strip("’")
list_of_words[index] = list_of_words[index].strip("‘")
# all we have now is a list with words without punctuation
# (secretly, some words still have apostrophes and dashes in 'em)
# (but we don't care)
return list_of_words
# ^^^ YOU DO NOT HAVE TO CHANGE ANYTHING IN HERE ^^^
# this is the function you'll add a lot of logic to
def count_how_many_words(word_list, counting_string):
"""takes in a string and a list and returns the number of times that string occurs in the list"""
return None # this is just here so the program still compiles
def main():
count = 0
words = break_into_list_of_words(THE_RAVEN)
# a reasonable first step, to see what you've got:
# for word in words:
# print(word, end = " ")
if __name__ == "__main__":
main()
In: Computer Science
Item 1
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
There is a design methodology called rapid prototyping, which has been used successfully in software engineering. Given similarities between software design and instructional design, we argue that rapid prototyping is a viable method for instructional design, especially for computer-based instruction. References: |
Tripp and Bichelmeyer (1990) suggested that rapid prototyping could be an advantageous methodology for developing innovative computer-based instruction. They noted that this approach has been used successfully in software engineering; hence, rapid prototyping could also be a viable method for instructional design due to many parallels between software design and instructional design.
|
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 2
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
In examining the history of the visionary companies, we were struck by how often they made some of their best moves not by detailed strategic planning, but rather by experimentation, trial and error, opportunism, and--quite literally--accident. What looks in hindsight like a brilliant strategy was often the residual result of opportunistic experimentation and "purposeful accidents." References: |
When I look back on the decisions I've made, it's clear that I made some of my best choices not through a thorough analytical investigation of my options, but instead by trial and error and, often, simply by accident. The somewhat random aspect of my success or failure is, at the same time, both encouraging and scary. |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 3
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
Major changes within organizations are usually initiated by those who are in power. Such decision-makers sponsor the change and then appoint someone else - perhaps the director of training - to be responsible for implementing and managing change. Whether the appointed change agent is in training development or not, there is often the implicit assumption that training will "solve the problem." And, indeed, training may solve part of the problem.... The result is that potentially effective innovations suffer misuse, or even no use, in the hands of uncommitted users. References: |
When major changes are initiated in organizations, "... there is often the implicit assumption that training will 'solve the problem.' And, indeed, training may solve part of the problem." (Dormant, 1986, p. 238).
|
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 4
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
Merck, in fact, epitomizes the ideological nature--the pragmatic idealism--of highly visionary companies. Our research showed that a fundamental element in the "ticking clock" of a visionary company is a core ideology--core values and a sense of purpose beyond just making money--that guides and inspires people throughout the organization and remains relatively fixed for long periods of time. References: |
While some have identified Merck as a visionary company dedicated to a "core values and a sense of purpose beyond just making money" (Collins & Porras, 2002, p. 48), others point out corporate misdeeds perpetrated by Merck (e.g., its role in establishing a dubious medical journal that republished articles favorable to Merck products) as contradictory evidence. References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 5
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
The philosophical position known as constructivismviews knowledge as a human construction. The various perspectives within constructivism are based on the premise that knowledge is not part of an objective, external reality that is separate from the individual. Instead, human knowledge, whether the bodies of content in public disciplines (such as mathematics or sociology) or knowledge of the individual learner, is a human construction. References: |
Does knowledge exist outside of, or separate from, the individual who knows? Constructivists argue that "... human knowledge, whether the bodies of content in public disciplines (such as mathematics or sociology) or knowledge of the individual learner, is a human construction." References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 6
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
When instructors are creating discussion board activities for online courses, at least two questions must be answered. First, what is the objective of the discussions? Different objectives might be to create a "social presence" among students so that they do not feel isolated, to ask questions regarding assignments or topics, or to determine if students understand a topic by having them analyze and evaluate contextual situations. Based on the response to this question, different rules might be implemented to focus on the quality of the interaction more so than the quantity. The second question is, how important is online discussions in comparison to the other activities that students will perform? This question alludes to the amount of participation that instructors expect from students in online discussions along with the other required activities for the course. If a small percentage of student effort is designated for class participation, our results show that it can affect the quality and quantity of interactions. References: |
According to Moore and Marra's (2005) case study, which observed two online courses, students in the first course implemented a constructive argumentation approach while students in second course had less structure for their postings. As they stated, when instructors create online discussion board activities, they must answer at least two questions. These questions are: "What is the objective of the discussions?" And "How important are online discussions in comparison to the other activities that students will perform?" According to their findings, the discussion activities that were designed based on the answers to these questions can influence the quality and quantity of interactions (Moore & Marra, 2005). References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 7
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
The philosophical position known as constructivismviews knowledge as a human construction. The various perspectives within constructivism are based on the premise that knowledge is not part of an objective, external reality that is separate from the individual. Instead, human knowledge, whether the bodies of content in public disciplines (such as mathematics or sociology) or knowledge of the individual learner; is a human construction. References: |
Constructivist philosophers assert that knowledge is made by humans themselves. Knowledge is not "out there" in some external reality separate from us. It is we humans who create the content in disciplines such as math and biology. That knowledge would not exist without people making it. References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 8
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
But what are reasonable outcomes of the influence of global processes on education?While the question of how global processes influence all aspects of education (and who controls these forces) is multidimensional and not completely testable, there appear to be some theories of globalization as it relates to education that can be empirically examined. References: |
Rutkowski and Rutkowski (2009) ask "what are reasonable outcomes of the influence of global processes on education?" (p. 138). This question is not entirely testable and has multiple dimensions but theories of globalization's impact on education exist and provide means of empirical analysis. References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 9
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
In a complex task such as creating a website for learning, instructors may want to support the generation of multiple solutions in learners' peer feedback. Anonymity may create a social context where learners feel freer to express varied ideas, and make the task of giving feedback less inhibited. However, teachers need to know just how anonymity impacts the learning dynamic in order to make informed choices about when anonymous configurations are appropriate in peer feedback. References: |
According to Howard, Barrett, and Frick (2010), in order to make appropriate choices educators must understand the ways in which hiding or showing the identity of participants can impact the interaction that takes place in peer feedback activities. Obscuring the identity of participants in peer feedback "may create a social context where learners feel freer to express varied ideas, and make the task of giving feedback less inhibited" (p. 90). References: |
Which of the following is true for the Student Version above?
Word-for-Word plagiarism
Paraphrasing plagiarism
This is not plagiarism
Hints
Item 10
In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button.
|
Original Source Material |
Student Version |
|
While solitary negative reactions or unjustified suggestions for change have the potential to dissipate discourse rather than build it, the pattern analysis shows that the anonymous condition seemed to provide a safe explorative space for learners to try out more reasons for their multiple solutions. Teachers will rarely give anonymous feedback, but the experience of giving anonymous feedback may open a social space where learners can try out the reasons for their suggestions. References: |
In their study of anonymity in an online peer feedback activity, the authors found that, under conditions of anonymity, learners seemed more inclined to provide reasons to back up their suggestions (Howard, Barrett, & Frick, 2010). Getting both suggestions and the reasons for the suggestions would be welcome in feedback I receive from peers or my instructors. Seeing the reasons would help me know that the suggestions have been thought through (even if I don't always agree with them). References: |
In: Operations Management
java programming
You will be given two interfaces and two abstract classes, FileTextReader, FileTextWriter, AbstractFileMonitor, and AbstractDictionary. Your job is to create two classes the first class should be named FileManager, the second class should be named Dictionary. The FileManager will implement the interfaces FileTextReader and FileTextWriter and extend the clas AbstractFileMonitor. Your class signature would look something like the following:
public class FileManager extends AbstractFileMonitor implements FileTextReader, FileTextWriter{...
The constructor signature of the FileManager should look like the following:
public FileManager(String filePath){...
The Dictionary will extend the abstract class AbstractDictionary. Your class signature would look something like the following:
public class Dictionary extends AbstractDictionary {...
The constructor signature of the Dictionary should look like the following:
public Dictionary(String path, FileManager fileManager) throws IOException {...
Please read the programmatic documentation of the two interfaces and abstract classes to gain an understanding of what each function should do. This assignment will test your knowledge of reading and writing to a text file, implementing interfaces, extending abstract classes, throwing exceptions and working with collections specifically sets.
This project is accompanied by two test classes, ManagerTest, and DictionaryTest. They will test the functionality of the functions in the interfaces and the abstract methods of classes. Its recommended that you implement the FileManager before working on the AbstractDictionary.
Abstract Dictionary
package homework;
import java.io.IOException;
import java.util.Objects;
import java.util.Set;
* A class that holds a collection of words read from a text
file. The collection of words is used in the methods of this
class
* methods provided in this class.
public abstract class AbstractDictionary
{
private final FileTextReader
FILE_READER;
private final Set ALL_WORDS;
/**
* Creates an abstract dictionary of words using the
text file at the specified path.
* @param path a path to a text file containing a
dictionary of words
* @param dictionaryFileReader the FileReader used to
read from the text file at the specified path
* @throws IOException thrown if there is a problem
reading the file at the path
*/
public AbstractDictionary(String path,
FileTextReader dictionaryFileReader) throws IOException {
Objects.requireNonNull(dictionaryFileReader, "The File reader can
not be null");
Objects.requireNonNull(path, "The
path can not be null");
FILE_READER = dictionaryFileReader;
ALL_WORDS =
FILE_READER.getAllLines(path);
}
/**
* Returns a set of all the words contained in the
dictionary text file.
* @return a set containing all the words in the
dictionary file.
*/
public Set getAllWords(){
return ALL_WORDS;
}
/**
* Counts the number of words in this Dictionary that
start with the specified prefix and have a length that is equal or
greater
* than the specified size. If size the specified size
is less than 1 then word size is not taken into account.
* @param prefix the prefix to be found
* @param size the length that the word must equal or
be greater than. If a value less than 1 is specified, all words
regardless of their
* characters size should be considered. In other words
if the size parameter is < 1 word size is disregarded in the
calculations.
* @param ignoreCase if true this will ignore case
differences when matching the strings. If false this
considers
* case differences when matching the strings
* @return The number of words that start with the
specified prefix
* @throws IllegalArgumentException if the specified
string is null or empty (Meaning contains no characters or only
white space or blank)
*/
public abstract int countWordsThatStartWith(String prefix, int size, boolean ignoreCase) throws IllegalArgumentException;
/**
* Tests if this Dictionary contains at least one word
with a length equal to or greater than the specified size that
starts with the specified prefix.
* If size the specified size is less than 1 then word
size is not taken into account.
* @param prefix the prefix to be found
* @param size the length that the word must equal or
be greater than. If a value less than 1 is specified, all words
regardless of their
* characters size should be considered. In other words
if the size parameter is < 1 word size is disregarded in the
calculations.
* @param ignoreCase if true this will ignore case
differences when matching the strings. If false this
considers
* case differences when matching the strings
* @return The number of words that start with the
specified prefix
* @throws IllegalArgumentException if the specified
string is null or empty (Meaning contains no characters or only
white space)
*/
public abstract boolean
containsWordsThatStartWith(String prefix, int size, boolean
ignoreCase) throws IllegalArgumentException;
* Returns a set of all the words within in this
Dictionary that start with the specified prefix and have a length
that is equal or greater
* than the specified size. If size the specified size
is less than 1 then word size is not taken into account.
* @param prefix the prefix to be found
* @param size the length that the word must equal or
be greater than. If a value less than 1 is specified, all words
regardless of their
* characters size should be considered. In other words
if the size parameter is < 1 word size is disregarded in the
calculations.
* @param ignoreCase if true this will ignore case
differences when matching the strings. If false this
considers
* case differences when matching the strings
* @return A list of all strings that start with the
specified prefix
* @throws IllegalArgumentException if the specified
string is null or empty (Meaning contains no characters or only
white space)
public abstract Set
getWordsThatStartWith(String prefix, int size, boolean ignoreCase)
throws IllegalArgumentException;
}
AbstractFileMonitor
package homework;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
* A class with methods to monitor a text file.
public abstract class AbstractFileMonitor {
private MessageDigest messageDigest;
private int currentCheckSum;
private boolean hasChanged = false;
private long nextUpateTime = 0;
public AbstractFileMonitor(String path){
setFilePath(path);
}
* Updates the variables that correspond to the file
being monitored
* This function has been throttled such that it will
only update values every 250 ms. In other words successive calls to
this
* function in time intervals that are less than 250 ms
will yield no change.
* @throws IOException Thrown if any type of I/O
exception occurs while writing to the file
* @throws IllegalStateException If the {@link
#setFile(String)} method in not invoked with a proper file prior to
invocation of this
* @throws NoSuchAlgorithmException If the computer's
OS is missing the SHA-256 hashing algorithm
* method. In other words if no file is currently set
to be monitored.
public void update() throws IOException,
IllegalStateException, NoSuchAlgorithmException {
if(messageDigest ==
null){
messageDigest =
MessageDigest.getInstance("SHA-256");
}
if(nextUpateTime >
System.currentTimeMillis()) {
hasChanged =
false;
return;
}
nextUpateTime =
System.currentTimeMillis() + 250;
File file = new
File(getFilePath());
if(!file.exists())
return;
try (DigestInputStream dis = new DigestInputStream(new
FileInputStream(getFilePath()), messageDigest)) {
while (dis.read() != -1) ;
messageDigest = dis.getMessageDigest();
}
StringBuilder result = new StringBuilder();
for (byte b : messageDigest.digest()) {
result.append(String.format("%02x", b));
}
hasChanged = currentCheckSum !=
result.toString().hashCode();
currentCheckSum = result.toString().hashCode();
}
* Tests if the file being monitored has changed since
the last time {@link #update()} was invoked
public boolean hasChanged(){
return hasChanged;
}
public abstract void setFilePath(String path);
public abstract String getFilePath() throws
IllegalStateException;
}
FileTextReader
package homework;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Set;
public interface FileTextReader{
public String readText(String path) throws
IOException;
* @throws IOException Thrown if any type of I/O
exception occurs while writing to the file
public Set getAllLines(String path) throws
IOException;
* @throws IOException Thrown if any type of I/O
exception occurs while writing to the file
public String getLastLine(String path) throws
IOException;
}
FileTextWriter
package homework;
import java.io.IOException;
public interface FileTextWriter {
* @throws IOException Thrown if any type of I/O
exception occurs while writing to the file
* @throws IllegalArgumentException if the specified
string is null or empty (Meaning contains no characters or only
white space)
public void writeToFile(String string,
String path) throws IOException,
IllegalArgumentException;
}
In: Advanced Math
java programming
You will be given two interfaces and two abstract classes, FileTextReader, FileTextWriter, AbstractFileMonitor, and AbstractDictionary. Your job is to create two classes the first class should be named FileManager, the second class should be named Dictionary. The FileManager will implement the interfaces FileTextReader and FileTextWriter and extend the clas AbstractFileMonitor. Your class signature would look something like the following:
public class FileManager extends AbstractFileMonitor implements FileTextReader, FileTextWriter{...
The constructor signature of the FileManager should look like the following:
public FileManager(String filePath){...
The Dictionary will extend the abstract class AbstractDictionary. Your class signature would look something like the following:
public class Dictionary extends AbstractDictionary {...
The constructor signature of the Dictionary should look like the following:
public Dictionary(String path, FileManager fileManager) throws IOException {...
Please read the programmatic documentation of the two interfaces and abstract classes to gain an understanding of what each function should do. This assignment will test your knowledge of reading and writing to a text file, implementing interfaces, extending abstract classes, throwing exceptions and working with collections specifically sets.
This project is accompanied by two test classes, ManagerTest, and DictionaryTest. They will test the functionality of the functions in the interfaces and the abstract methods of classes. Its recommended that you implement the FileManager before working on the AbstractDictionary.
Abstract Dictionary
package homework;
import java.io.IOException;
import java.util.Objects;
import java.util.Set;
* A class that holds a collection of words read from a text
file. The collection of words is used in the methods of this
class
* methods provided in this class.
public abstract class AbstractDictionary
{
private final FileTextReader
FILE_READER;
private final Set ALL_WORDS;
/**
* Creates an abstract dictionary of words using the
text file at the specified path.
* @param path a path to a text file containing a
dictionary of words
* @param dictionaryFileReader the FileReader used to
read from the text file at the specified path
* @throws IOException thrown if there is a problem
reading the file at the path
*/
public AbstractDictionary(String path,
FileTextReader dictionaryFileReader) throws IOException {
Objects.requireNonNull(dictionaryFileReader, "The File reader can
not be null");
Objects.requireNonNull(path, "The
path can not be null");
FILE_READER = dictionaryFileReader;
ALL_WORDS =
FILE_READER.getAllLines(path);
}
/**
* Returns a set of all the words contained in the
dictionary text file.
* @return a set containing all the words in the
dictionary file.
*/
public Set getAllWords(){
return ALL_WORDS;
}
/**
* Counts the number of words in this Dictionary that
start with the specified prefix and have a length that is equal or
greater
* than the specified size. If size the specified size
is less than 1 then word size is not taken into account.
* @param prefix the prefix to be found
* @param size the length that the word must equal or
be greater than. If a value less than 1 is specified, all words
regardless of their
* characters size should be considered. In other words
if the size parameter is < 1 word size is disregarded in the
calculations.
* @param ignoreCase if true this will ignore case
differences when matching the strings. If false this
considers
* case differences when matching the strings
* @return The number of words that start with the
specified prefix
* @throws IllegalArgumentException if the specified
string is null or empty (Meaning contains no characters or only
white space or blank)
*/
public abstract int countWordsThatStartWith(String prefix, int size, boolean ignoreCase) throws IllegalArgumentException;
/**
* Tests if this Dictionary contains at least one word
with a length equal to or greater than the specified size that
starts with the specified prefix.
* If size the specified size is less than 1 then word
size is not taken into account.
* @param prefix the prefix to be found
* @param size the length that the word must equal or
be greater than. If a value less than 1 is specified, all words
regardless of their
* characters size should be considered. In other words
if the size parameter is < 1 word size is disregarded in the
calculations.
* @param ignoreCase if true this will ignore case
differences when matching the strings. If false this
considers
* case differences when matching the strings
* @return The number of words that start with the
specified prefix
* @throws IllegalArgumentException if the specified
string is null or empty (Meaning contains no characters or only
white space)
*/
public abstract boolean
containsWordsThatStartWith(String prefix, int size, boolean
ignoreCase) throws IllegalArgumentException;
* Returns a set of all the words within in this
Dictionary that start with the specified prefix and have a length
that is equal or greater
* than the specified size. If size the specified size
is less than 1 then word size is not taken into account.
* @param prefix the prefix to be found
* @param size the length that the word must equal or
be greater than. If a value less than 1 is specified, all words
regardless of their
* characters size should be considered. In other words
if the size parameter is < 1 word size is disregarded in the
calculations.
* @param ignoreCase if true this will ignore case
differences when matching the strings. If false this
considers
* case differences when matching the strings
* @return A list of all strings that start with the
specified prefix
* @throws IllegalArgumentException if the specified
string is null or empty (Meaning contains no characters or only
white space)
public abstract Set
getWordsThatStartWith(String prefix, int size, boolean ignoreCase)
throws IllegalArgumentException;
}
AbstractFileMonitor
package homework;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
* A class with methods to monitor a text file.
public abstract class AbstractFileMonitor {
private MessageDigest messageDigest;
private int currentCheckSum;
private boolean hasChanged = false;
private long nextUpateTime = 0;
public AbstractFileMonitor(String path){
setFilePath(path);
}
* Updates the variables that correspond to the file
being monitored
* This function has been throttled such that it will
only update values every 250 ms. In other words successive calls to
this
* function in time intervals that are less than 250 ms
will yield no change.
* @throws IOException Thrown if any type of I/O
exception occurs while writing to the file
* @throws IllegalStateException If the {@link
#setFile(String)} method in not invoked with a proper file prior to
invocation of this
* @throws NoSuchAlgorithmException If the computer's
OS is missing the SHA-256 hashing algorithm
* method. In other words if no file is currently set
to be monitored.
public void update() throws IOException,
IllegalStateException, NoSuchAlgorithmException {
if(messageDigest ==
null){
messageDigest =
MessageDigest.getInstance("SHA-256");
}
if(nextUpateTime >
System.currentTimeMillis()) {
hasChanged =
false;
return;
}
nextUpateTime =
System.currentTimeMillis() + 250;
File file = new
File(getFilePath());
if(!file.exists())
return;
try (DigestInputStream dis = new DigestInputStream(new
FileInputStream(getFilePath()), messageDigest)) {
while (dis.read() != -1) ;
messageDigest = dis.getMessageDigest();
}
StringBuilder result = new StringBuilder();
for (byte b : messageDigest.digest()) {
result.append(String.format("%02x", b));
}
hasChanged = currentCheckSum !=
result.toString().hashCode();
currentCheckSum = result.toString().hashCode();
}
* Tests if the file being monitored has changed since
the last time {@link #update()} was invoked
public boolean hasChanged(){
return hasChanged;
}
public abstract void setFilePath(String path);
public abstract String getFilePath() throws
IllegalStateException;
}
FileTextReader
package homework;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Set;
public interface FileTextReader{
public String readText(String path) throws
IOException;
* @throws IOException Thrown if any type of I/O
exception occurs while writing to the file
public Set getAllLines(String path) throws
IOException;
* @throws IOException Thrown if any type of I/O
exception occurs while writing to the file
public String getLastLine(String path) throws
IOException;
}
FileTextWriter
package homework;
import java.io.IOException;
public interface FileTextWriter {
* @throws IOException Thrown if any type of I/O
exception occurs while writing to the file
* @throws IllegalArgumentException if the specified
string is null or empty (Meaning contains no characters or only
white space)
public void writeToFile(String string, String
path) throws IOException, IllegalArgumentException;
}
We need to create that two classes.
In: Computer Science
Research the range of contemporary issues teenagers face today. In a 500-750-word paper, choose one issue (besides teen pregnancy) and discuss its effect on adolescent behavior and overall well-being. Include the following in your submission:
In: Nursing
Part 1: Model Building
1. Submit both this word and excel file
2. Keep two decimal places for your answer
Using the data Reynolds.xls. The variables are defined as:
Sales (Y) =number of electronic laboratory scales sold
Months (X) =the number of months the salesperson has been employed
1. Develop the scatter plot using Sales as y axis and Months as x axis, and can you see the curvature?
2. Using a simple linear regression model to develop an estimated regression equation to predict the Sales. What is the adjusted-R square?
3. Using a second-order regression model to develop an estimated regression equation to predict the Sales. What is the adjusted-R square? (Hint: second-order regression model should look like: y=b0+b1X+b2X2, and we learnt it in Chapter 16)
4. Compare the adjusted-R square from 2 and 3, which one is larger? Which model is better? (Hint: we learn this in Chapter 15)
5. Use 4 diagrams to test the 5 model assumptions for the second-order regression model. Do you think they are violated? (Hint: we learn this in week 12 computer skill class)
| Months | Sales |
| 41 | 275 |
| 106 | 296 |
| 76 | 317 |
| 104 | 376 |
| 22 | 162 |
| 12 | 150 |
| 85 | 367 |
| 111 | 308 |
| 40 | 189 |
| 51 | 235 |
| 9 | 83 |
| 12 | 112 |
| 6 | 67 |
| 56 | 325 |
| 19 | 189 |
In: Statistics and Probability
Tobacco smoking (1500 Word)
Tobacco smoking has long been established as a serious public health concern in Australia. The Australian government and health groups have used a multi-pronged strategy to reduce smoking rates over time. Discuss the economic rationale for these strategies and their likely impact on the consumption of tobacco products and subsequent health outcomes. In your answer, include the following:
a. The operation of an excise tax on tobacco product sales, using demand and supply curves to explore its impact.
b. The role of anti-smoking education campaigns to address potential market failure.
|
Criteria |
|
Description of the issue |
|
Identification of relevant economic theory |
|
Use of analytic tools |
|
Clearly written and addresses all aspects of the question and is well researched. |
In: Economics