Background For this exercise, you will write an Appointment class that tracks information about an appointment such as the start and end times and a name for the appointment. Your Appointment class will also have an overlaps() method that takes another Appointment object as an argument and determines whether the two appointments overlap in python.
Instructions
Write a class called Appointment with methods as described below:
__init__() method Define an __init__() method with four parameters: self name, a string indicating the name of the appointment (for example, "Sales brunch"). start, a tuple consisting of two integers representing the start time of the appointment. The first integer represents an hour in 24-hour time; the second integer represents a number of minutes. For example, the tuple (10, 30) would represent 10:30 am. end, a tuple similar to start representing the end time of the appointment. The __init__() method should create attributes name, start, and end, and use them to store the information from the parameters.
overlaps() method Define an overlaps() method with two parameters, self and other, where other is another Appointment object. This method should return True if self and other overlap and False if they do not. Be sure to return a boolean value rather than a string. Note that two appointments overlap if the start time of one appointment occurs between the start and end times of the other appointment (including if the start times are equal), OR the end time of one appointment occurs between the start and end times of the other appointment (including if the end times are equal) For this assignment, if the start time of one appointment is equal to the end time of the other appointment, the two appointments are not considered to overlap. Hints Assuming you have two values a and c such that a is less than c, you can determine if a third value b is between a (inclusive) and c (exclusive) with an expression like this: a <= b < c When Python compares two sequences (such as tuples), it compares each item in the first sequence to the corresponding item in the second sequence until it finds a difference. For example, given the expression (10, 4, 12) < (10, 5, 1), Python first compares 10 to 10. Because they are the same, Python then compares 4 to 5. Because 4 is smaller than 5, Python stops comparing and the expression evaluates to True: (10, 4, 12) is considered less than (10, 5, 1) in Python. A boolean expression such as a <= b < c evaluates to True or False. You don’t need to put it inside a conditional statement to return a boolean value. In other words, instead of this: if a <= b < c: return True else: return False you can do this: return a <= b < c
Docstrings Write a docstring for your class that documents the purpose of the class as well as the purpose and expected data type of each attribute. For each of the methods you wrote, write a docstring that documents the purpose of the method as well as the purpose and expected data type of each parameter other than self (you never need to document self in a docstring). If your document returns a value, document that. If your document has side effects, such as modifying attributes or writing to standard output, document those as well. Be sure your docstrings are the first statement in the class or method they document. Improperly positioned docstrings are not recognized as docstrings by Python.
Using your class You can use your class by importing your module into another script. Below is an example of such a script; it assumes the Appointment class is defined in a script called appointment.py which is located in the same directory as this script. use_appointment.py from appointment import Appointment def main(): """ Demonstrate use of the Appointment class. """ appt1 = Appointment("Physics meeting", (9, 30), (10, 45)) appt2 = Appointment("Brunch", (10, 30), (11, 00)) appt3 = Appointment("English study session", (13, 00), (14, 00)) if appt1.overlaps(appt2): print(f"{appt1.name} overlaps with {appt2.name}") else: print(f"{appt1.name} does not overlap with {appt2.name}") if appt1.overlaps(appt3): print(f"{appt1.name} overlaps with {appt3.name}") else: print(f"{appt1.name} does not overlap with {appt3.name}") assert appt1.overlaps(appt2) assert appt2.overlaps(appt1) assert not appt1.overlaps(appt3) assert not appt3.overlaps(appt1) assert not appt2.overlaps(appt3) assert not appt3.overlaps(appt2) if __name__ == "__main__": main()
In: Computer Science
In: Computer Science
. Suppose that the lifetime of a charged electronic device is uniformly distributed in the interval [5, 6] hours. Suppose you take 20 measurements. Compute the following • The probability that the mean over the 10 measurements exceeds 5.6 hours. • The probability that the mean lies between 5.45, and 5.55 hours. • The probability that the mean exceeds 6.1 hours. Think about this last point carefully: Do it first by applying the central limit theorem, but then explain whether this answer makes sense or not.
In: Math
Describe possible psychosocial stressors inherent in working with clients in mental health and wellness settings. What types of community resources would you recommend in these situations? How would you incorporate community resources into treatment? Please cite the answer
In: Psychology
Discuss the negativity in the lyrics of 90s grunge and industrial rock music such as "Smells Like Teen Spirit" and "Terrible Lie". Why do you think this genre was so popular in a time of relative peace and great prosperity in the United States?
In: Psychology
As you read about the actions and reactions of young people cited from intergenerational research, with which strategies and responses do you identify? Which do you believe are uncharacteristic of you?
In: Operations Management
Textbook: The developing person through the life span 10th edition, Berger,Kathleen. The peer group is a part of the social development of middle childhood children. These groups are 1) culture of children, 2) friendship, 3) popular and unpopular children and 4) bullies and victims. Summarize your thoughts on bullies and victims and their effects on children. What are your thoughts on this group?
In: Psychology
In: Psychology
Consider 2 alleles in a population of seahorses: A and a. There are 2 sea horses with genotype AA, 96 seahorses with genotype Aa and 2 seahorses with genotype aa. What are the frequencies of the alleles in this population. Please show all work. Is this population in the Hardy Weinberg Equilibrium? Explain why or why not. THANKS IN ADVANCE!! :)
In: Biology
Evaluate various approaches organisations use to monetise digital data.
In: Operations Management
Jed Smith is a 38-year-old welder who came into the treatment center after being arrested for drinking and driving (DUI/DWI). His attorney has suggested that he quit drinking and enter treatment, at least until his trial, which is scheduled to occur in 2 months. Jed does not anticipate serving jail time, but he believes that treatment could strengthen his legal case. After his first arrest for DUI 2 years ago, he simply paid a fine and attended a special driver's education program for 6 weeks. Jed found the program to be a “waste of time.”
Jed has been married for 8 years and has two daughters, aged 8 and 6. He has had numerous arguments with his wife, Emily, concerning his drinking. He gets very angry and defensive when she confronts him about his heavy drinking and he asserts that he is not an alcoholic. He knows this is true because his father was an alcoholic and Jed says that he is not like his father. His father died as the result of a fight that occurred in traffic when he was drunk. Jed says that his father used to “beat the tar” out of him and his brother when he was drunk and that his father always belittled, taunted, and threatened their mother, whether he was drunk or sober. Jed references that his family is Irish and that it was cultural normal to drink and enjoy alcohol and that all of his family and relatives drink in excess.
Jed's work history is very good; he misses less than one day per year. He works the day shift on weekdays, putting in time-and-a-half on most Saturdays. He is well regarded by his supervisors and peers at work. He is fearful that his employer will find out about his treatment (it is being covered by his HMO), and that people at work will learn about the second DUI arrest.
Jed drinks with his buddies from the plant, and does not think that his drinking is any more than what they do. He was just “unlucky” and was caught doing what everyone else seems to get away with. Jed's drinking is very predictable: he drinks 8-9 beers on a weeknight. Several of these are consumed at the bar with friends, the remainder at home over the course of the evening. He usually falls asleep in front of the television. When he is not working on Saturdays, he often drinks several 12-packs between Friday and Sunday. A typical Saturday involves getting up at 10:00 a.m., playing soccer with friends, and going to the bar for the rest of the day and night. This pattern leads to arguments with Emily, who calls him a “lousy father.” At times, Jed has had unsettling episodes of being unable to recall what happened while drinking. He has commented to friends that “maybe I overdo it a bit.” Several times, he has attempted to cut down on his drinking, especially after the last DUI. He once attended a few AA meetings, but did not feel that AA was helpful: "It was listening to a lot of guys whining…" and he especially did not care for the prayers.
Despite these attempts, Jed has experienced increased consumption levels over the past 2 years. He admits that, as a result of the drinking, he has become increasingly estranged from his wife and daughters. Jed feels that his marriage has been basically good, but that he would not blame Emily for leaving him, the way things have been going lately. She will no longer sleep with him while he is intoxicated, which occurs regularly. She complains that the house is falling apart because Jed does not keep up with his chores. He believes that his marriage would become solid again, if he stopped overdoing the drinking, but he complains about her hassling him about the alcohol.
Jed is not close to his remaining family members. His mother is very religious and wishes Jed would see religion as a way out of his problems. His siblings live in other communities and they rarely get together. His wife and daughters regularly attend his mother's church, but Jed only attends on Christmas Eve and Easter Sunday.
Jed is distraught about having to remain abstinent in preparation for the trial. He has trouble getting to sleep without alcohol. He also “gets jumpy” when he tries to stay away from drinking, feeling “closed in or like he is suffocating.” Jed reports that he is not used to socializing without alcohol and alcohol helps him relax and be more social with people.
Jed is willing to go to AA meetings only because he knows they may be court ordered and it may be better for his legal case. He does struggle with the philosophy of AA. He does not like the spirituality part of the program and does not like when people talk about God.
He does believe that he can go to the bars with his friends and not drink. He does think that he can increase his sports activities to help him not drink although many of his friends who play also drink.
Part 1: Harmful/Destructive Behaviors Chart
Complete the chart below by including a minimum of three behaviors as well as associated rewards and consequences related to relapse and abstinence behaviors.
|
Harmful/destructive behaviors that the client will need to avoid to prevent a relapse |
Possible rewards the client experiences when they choose to use drugs/engage in relapse activities. |
Possible costs for returning to use and the associated consequences |
|
|
|
|
|
|
|
|
Part 2: Current Risks of Relapse
In this section, you will identify the steps to reduce the risk of relapse. Describe how you might assist Jed to identify high-risk situations, and specific triggers leading to relapse.
Part 3: Relapse Response Plan
In this section, you will create a response plan to use when the client is faced with triggers and urges to lapse into using behavior. Complete the chart below and include coping strategies, client’s skills to redirect thoughts, and immediate actions to take before using substances.
|
List three people that the client identifies for a supportive network |
List three new activities the client can use as they shift their focus away from the destructive activities involved in their addiction |
List three actions or coping responses the client will utilize when a potentially negative pattern of behavior or high-risk situation emerges. |
|
|
|
|
|
|
|
|
Part 4: Continued Health and Well-Being
|
Jed Smith |
|
|
Client Signature |
Date |
|
Counselor Signature |
In: Psychology
In: Computer Science
In: Operations Management
APC industries has been experiencing significant growth and has been having difficulty meeting customer demands recently. They are considering three options to address this issue. They can move to a larger facility, add a second shift or use a subcontractor to assist in production. The annual payoff of each option depends on if the current market continues to expand, hold steady or declines. The expected payoff for each combination is show in the table below
Option Expand Steady Decline
Move to larger facility 250,000 125,000 -90,000
Add a second shift 175,000 80000 -45,000
Subcontract 90,000 15,000 -10,000
a) Which alternative should APC choose under the maximax criterion? (1 mark)
b) Which option should APC choose under the maximin criterion? (1 mark)
c) Which option should APC choose under the LaPlace criterion?
d) Which option should APC choose with the Hurwicz criterion with α = 0.5?
e) Using a minimax regret approach, what alternative should she choose?
f) After reading about economic predictions, APC has assigned the probability that the market will be expand , or be steady or be weak at 20%, 50% and 30 %. Using expected monetary values, what option should be chosen and what is that optimal expected value?
g) What is the most that the APC should be willing to pay for additional information? Use Expected Regret
h) Use the alternative method to verify EVPI (3 marks
In: Operations Management
In: Computer Science