This assessment task aims to develop your ability to apply the first three phases of the clinical reasoning process, at an introductory level, to the patient scenario below.
You are a student nurse working with a school nurse (registered nurse) in a secondary school. You and your mentor are supervising a bubble soccer match this afternoon (26th March) which commenced at 1400 hrs. The match goes for 40 minutes with a 5-minute break in between the two halves. It is a hot and sunny day, the air temperature is 32 oC and the humidity is 45%.
https://www.youtube.com/watch?v=xQQo08CPGm8
After the match, your mentor asks you to perform a range of health assessments to make sure the students are fit to go home.
Jessie Lin is 16 years old and in Year 11.
It is now 1450 hours. You assess Jessie's vital signs and record the following results:
Jessie has flushed skin (see picture above) and her t-shirt is
soaked. Her past medical history has not yet been documented in the
school record as she is a new student and only enrolled in the
school last week after moving from another state. She informs you
that her mother is waiting for her in the car park, but she feels
very hot and that her heart feels like it is beating very fast. She
asks you for a bottle of cold water and a chair.
Jessie's previous observation records (on a clinical chart)
are:
| Date | BP | Pulse | RR | Temp |
|---|---|---|---|---|
| 23rd March 2020 | 110/60 | 70 | 14 | 36.8 |
| 24th March 2020 | 112/60 | 74 | 12 | 36.6 |
What you need to do in your clinical reasoning report
Suggestions for structuring your clinical reasoning report
There is no set template for how you have to structure your report as long as the sequence of the information that you present flows logically and the reader can follow your clinical reasoning as it unfolds.
The following suggestions are based on answers to frequently asked questions:
Criterion 1: Apply a beginnerâs level of clinical reasoning to assess and interpret health information in relation to the patientâs context.
Criterion 2: Apply knowledge of anatomy and principles of physiology to explain assessment findings in relation to the patientâs context.
Criterion 3: Apply a beginnerâs level of clinical reasoning to propose and justify further cues that are to be collected in relation to the patientâs context
Criterion 4: Communicate using academic writing conventions with references to scholarly sources of information that conform to the Harvard referencing style.
Your written report should be approximately 1000 words (+/- 10%)
In: Nursing
Instructions: In this assignment, you use linear regression to calculate the expected after exercising heart rate.
Steps:
1. Open the Heart Rate database and identify the X-variable (resting) and the Y-variable (after exercise).
2. Use the Scatter Plot function in the Insert Charts section of Excel to create a scatter plot of the X and Y variables
3. Add a trendline to the scatter plot (Find and View a YouTube video on how to do this if you need help)
4. Use the Data Analysis tools in Excel to perform regression analysis on the X and Y variables
In a Word document, describe the relationship between the X-variable (rest heart rate) and the Y-Variable (after exercise). Make certain you include the estimates for the intercept and the slope coefficients.
Heart Database:
| Heart rate before and after exercise | ||
| M=0 F=1 | Resting | After Exercise |
| 0 | 85.9 | 87.5 |
| 0 | 67.7 | 79.4 |
| 0 | 80.3 | 93.4 |
| 0 | 85.2 | 97.7 |
| 0 | 86.3 | 99.7 |
| 0 | 76.6 | 83.7 |
| 0 | 94.4 | 101.9 |
| 0 | 86.4 | 100.6 |
| 0 | 83.4 | 97.4 |
| 0 | 89.8 | 97.4 |
| 0 | 88.7 | 97.1 |
| 0 | 78.4 | 87.2 |
| 0 | 71.3 | 79.9 |
| 0 | 92.6 | 104.7 |
| 0 | 86.2 | 95.9 |
| 0 | 83.9 | 93.9 |
| 0 | 78.1 | 90.1 |
| 0 | 64.0 | 70.7 |
| 0 | 72.8 | 86.7 |
| 0 | 72.7 | 81.2 |
| 0 | 80.2 | 83.3 |
| 0 | 78.2 | 86.0 |
| 0 | 70.6 | 90.2 |
| 0 | 75.5 | 84.4 |
| 0 | 82.7 | 94.2 |
| 0 | 87.7 | 95.1 |
| 0 | 80.0 | 88.7 |
| 0 | 73.4 | 82.7 |
| 0 | 89.5 | 94.6 |
| 0 | 77.6 | 84.6 |
| 0 | 76.6 | 86.4 |
| 0 | 85.6 | 96.2 |
| 0 | 74.2 | 82.1 |
| 0 | 79.0 | 91.6 |
| 0 | 74.6 | 86.7 |
| 0 | 88.8 | 98.8 |
| 0 | 82.1 | 85.6 |
| 0 | 77.6 | 80.6 |
| 0 | 77.9 | 83.8 |
| 0 | 88.1 | 93.9 |
| 0 | 81.6 | 90.3 |
| 0 | 91.2 | 100.6 |
| 0 | 80.3 | 88.0 |
| 0 | 76.7 | 91.8 |
| 0 | 88.4 | 103.0 |
| 0 | 75.2 | 86.5 |
| 0 | 75.2 | 84.9 |
| 0 | 73.1 | 71.9 |
| 0 | 77.0 | 84.7 |
| 0 | 59.0 | 68.2 |
| 0 | 84.9 | 96.0 |
| 0 | 87.5 | 105.9 |
| 0 | 75.6 | 84.3 |
| 0 | 84.0 | 90.4 |
| 0 | 78.2 | 94.0 |
| 0 | 86.6 | 90.6 |
| 0 | 84.9 | 95.1 |
| 0 | 78.8 | 90.4 |
| 0 | 69.4 | 82.6 |
| 0 | 78.3 | 91.1 |
| 0 | 76.9 | 92.3 |
| 0 | 84.2 | 87.9 |
| 0 | 76.3 | 85.9 |
| 0 | 86.3 | 99.7 |
| 0 | 72.3 | 80.9 |
| 0 | 81.8 | 93.8 |
| 0 | 92.8 | 99.8 |
| 0 | 74.8 | 90.2 |
| 0 | 91.7 | 99.2 |
| 0 | 71.0 | 87.0 |
| 0 | 96.1 | 100.2 |
| 0 | 82.5 | 95.1 |
| 0 | 81.9 | 97.5 |
| 0 | 89.7 | 94.8 |
| 0 | 81.4 | 100.9 |
| 0 | 74.8 | 94.0 |
| 0 | 88.1 | 102.1 |
| 0 | 69.2 | 81.4 |
| 0 | 78.8 | 90.9 |
| 0 | 85.3 | 94.2 |
| 0 | 74.8 | 81.3 |
| 0 | 77.7 | 89.9 |
| 0 | 78.0 | 89.8 |
| 0 | 80.5 | 95.3 |
| 0 | 75.4 | 84.8 |
| 0 | 81.5 | 84.2 |
| 0 | 73.9 | 85.2 |
| 0 | 69.4 | 74.1 |
| 0 | 89.4 | 96.7 |
| 0 | 70.9 | 82.0 |
| 0 | 82.9 | 90.2 |
| 0 | 89.6 | 106.7 |
| 0 | 74.5 | 75.6 |
| 0 | 92.3 | 102.2 |
| 0 | 87.7 | 98.0 |
| 0 | 78.9 | 89.7 |
| 0 | 79.8 | 81.5 |
| 0 | 85.5 | 97.4 |
| 0 | 87.3 | 94.1 |
| 0 | 77.8 | 97.8 |
| 0 | 71.0 | 80.1 |
| 0 | 82.5 | 90.7 |
| 0 | 74.8 | 83.7 |
| 0 | 69.2 | 79.4 |
| 0 | 80.5 | 87.4 |
| 0 | 89.4 | 99.2 |
| 0 | 74.5 | 88.0 |
| 0 | 85.5 | 92.0 |
| 1 | 76.6 | 88.2 |
| 1 | 79.2 | 90.4 |
| 1 | 80.6 | 101.3 |
| 1 | 75.5 | 93.1 |
| 1 | 83.9 | 90.5 |
| 1 | 73.9 | 89.1 |
| 1 | 76.8 | 90.8 |
| 1 | 85.2 | 93.5 |
| 1 | 82.1 | 93.5 |
| 1 | 76.3 | 87.0 |
| 1 | 97.0 | 104.5 |
| 1 | 81.5 | 86.5 |
| 1 | 65.3 | 86.3 |
| 1 | 80.8 | 86.7 |
| 1 | 78.5 | 89.9 |
| 1 | 86.3 | 97.6 |
| 1 | 89.8 | 92.9 |
| 1 | 87.8 | 98.5 |
| 1 | 76.2 | 89.9 |
| 1 | 74.2 | 88.8 |
| 1 | 67.4 | 78.8 |
| 1 | 75.5 | 80.2 |
| 1 | 80.0 | 90.2 |
| 1 | 76.4 | 88.0 |
| 1 | 94.9 | 95.7 |
| 1 | 89.2 | 96.9 |
| 1 | 83.3 | 87.7 |
| 1 | 85.8 | 90.4 |
| 1 | 75.3 | 84.1 |
| 1 | 77.9 | 99.0 |
| 1 | 70.0 | 83.0 |
| 1 | 88.0 | 94.2 |
| 1 | 86.9 | 95.0 |
| 1 | 87.1 | 95.9 |
| 1 | 79.3 | 82.7 |
| 1 | 81.2 | 90.7 |
| 1 | 82.9 | 91.9 |
| 1 | 87.4 | 103.6 |
| 1 | 83.0 | 90.0 |
| 1 | 76.8 | 83.3 |
| 1 | 76.9 | 87.7 |
| 1 | 79.8 | 88.2 |
| 1 | 83.2 | 93.0 |
| 1 | 79.5 | 88.6 |
| 1 | 82.4 | 89.3 |
| 1 | 80.8 | 84.2 |
| 1 | 83.2 | 94.5 |
| 1 | 71.6 | 81.5 |
| 1 | 82.8 | 93.1 |
| 1 | 76.8 | 92.8 |
| 1 | 93.2 | 100.4 |
| 1 | 91.4 | 100.9 |
| 1 | 97.3 | 103.3 |
| 1 | 88.3 | 90.1 |
| 1 | 80.6 | 85.2 |
| 1 | 87.4 | 91.7 |
| 1 | 96.5 | 99.3 |
| 1 | 77.9 | 91.6 |
| 1 | 76.1 | 84.1 |
| 1 | 85.2 | 89.7 |
| 1 | 68.6 | 72.8 |
| 1 | 79.4 | 92.0 |
| 1 | 85.2 | 99.2 |
| 1 | 74.3 | 85.6 |
| 1 | 74.3 | 89.2 |
| 1 | 78.5 | 98.5 |
| 1 | 80.4 | 90.8 |
| 1 | 82.9 | 85.9 |
| 1 | 78.9 | 90.7 |
| 1 | 78.6 | 87.0 |
| 1 | 87.5 | 93.9 |
| 1 | 78.9 | 91.4 |
| 1 | 80.0 | 89.1 |
| 1 | 80.4 | 89.2 |
| 1 | 88.3 | 93.5 |
| 1 | 80.6 | 95.9 |
| 1 | 85.8 | 90.5 |
| 1 | 84.6 | 93.0 |
| 1 | 80.5 | 91.8 |
| 1 | 92.4 | 101.2 |
| 1 | 84.4 | 96.7 |
| 1 | 82.3 | 86.9 |
| 1 | 77.2 | 85.8 |
| 1 | 83.3 | 82.1 |
| 1 | 86.2 | 98.9 |
| 1 | 81.3 | 97.7 |
| 1 | 90.2 | 96.4 |
| 1 | 78.4 | 85.5 |
| 1 | 84.7 | 101.6 |
| 1 | 89.7 | 94.3 |
| 1 | 78.4 | 88.0 |
| 1 | 79.9 | 88.5 |
In: Statistics and Probability
Please state which function of money is being used by each of the following activities: Unit of Account (Standard of Value, Medium of Exchange or Store of Value. Please explain the reasoning behind each answer.
(a) Brenda puts $600 into her cookie jar for a rainy day.
(b) Brenda records the money she has spent on gasoline this year.
(c) Brenda buys a $100 Savings Bond.
(d) Brenda uses $2,400 to pay her rent.
(a) Please state what assets are part of the money measurement called M1.
(b) Please state what assets are part of the money measurement called M2
Please give the reasoning for each answer.
(a) Mary puts $400 in cash into her Savings Account.
(b) Sam transfers $40 from his Checking Account into his Savings Account.
(c) Chen takes $60 out of his Savings Account at the ATM machine.
(d) Brenda puts $50 in cash into her cookie jar at home for a rainy day.
(a) Assume that a one year bond that has no interest coupon payment with a maturity value (face value) of $2,000 sold for $1,700. Show the interest rate that this bond will pay when it matures.
(b) If the prices of similar bonds are selling next month for $1,900, show the interest rate that these bonds pay when they mature.
(c) Based on your answers in (a) and (b) above, describe the relationship between the price of bonds and the interest rate.
Your friend owns a cabin in the mountains in Big Bear California that he inherited from his mother. Your friend likes to visit that cabin during the year whenever he wants to. Thus, he leaves it vacant when he is not there. Your friend says that it is an inexpensive way to have short vacations: visit a place he owns.
Please explain why your friend is wrong in stating that this is an inexpensive way to have short vacations.
(a) Please provide a description of Bank Runs.
(b) Explain the main cause of Bank Runs.
(c) Why do you think we no longer see many Bank Runs today.
Please explain what backing U.S. Federal Reserve Notes have today and why people accept them for payment for goods and services.
Part 1 of Question 8 (12 points)
Below is the Balance Sheet for the Bank of Upland as of October 1, 2017. The required reserve ratio is 5%. Using this information and the Balance Sheet below answer the following questions.
|
Bank of Upland |
|
|
Assets |
Liabilities |
|
$50 million Home Loans |
$900 million Demand Deposits |
|
$200 million Treasury Bonds |
|
|
$70 million Car Loans |
|
|
$80 million Business Loans |
|
|
$100 million Credit Card Loans |
|
|
$360 million On Deposit at the Fed |
|
|
$40 million in Vault Cash |
|
|
$900 million Total Assets |
$900 million Total Liabilities |
(a) Calculate the Bank of Uplandâs Total Reserves as of October 1,
2017 (please show/explain how you got your answer)
b) Calculate the Bank of Uplandâs Required Reserves as of October 1, 2017 (please show/explain how you got your answer).
c) Calculate the Bank of Uplandâs Excess Reserves as of October 1, 2017 (please show/explain how you got your answer).
d) Determine the amount of Bank of Uplandâs Total Reserves which can legally be loaned out as of October 1, 2017 (please show/explain how you got your answer).
e) Calculate the Bank of Uplandâs Money Creating Potential throughout the entire Banking System as of October 1, 2017 (please show/explain how you got your answer).
Part 2 of Question 8 (17 points)
Start with the same Balance Sheet and required reserve
ratio found in Part 1 above, and using the fact that the
Federal Reserve had just sold $120 million worth
of Treasury Bonds (T-bonds) to the Bank of Upland at the end of
business on October 1, 2017 (no other transaction occurred at the
Bank of Upland on October 1, 2017), answer the following
questions.
a) Fill in the Bank of Uplandâs Balance Sheet numbers as of the
start of business on October 2, 2017 for the categories found
below. Start with the numbers in Part 1 above and incorporate the
fact that the Federal Reserve (using Open Market Operations) had
just sold $120 million worth of Treasury Bonds
(T-bonds) to the Bank of Upland. Using a Word Table might help.
|
Bank of Upland |
|
|
Home Loans |
Demand Deposits |
|
Treasury Bonds |
|
|
Car Loans |
|
|
Business Loans |
|
|
Credit Card Loans |
|
|
On Deposit at the Fed |
|
|
Vault Cash |
|
|
Total Assets |
Total Liabilities |
b) Calculate the Bank of Uplandâs Total Reserves as of October 2, 2017 (please show/explain how you got your answer).
c) Calculate the Bank of Uplandâs Required Reserves as of October 2, 2017 (please show/explain how you got your answer).
d) Calculate the Bank of Uplandâs Excess Reserves as of October 2, 2017 (please show/explain how you got your answer).
e) Calculate the Bank of Uplandâs Money Creating Potential throughout the entire Banking System as of October 2, 2017 (please show/explain how you got your answer).
f) Explain the reason the Federal Reserve would Sell these T-bonds to the Bank of Upland and explain what the Federal Reserve is worried about. (In other words, what economic condition is the Fed trying to avoid and how would the bond purchase help the Fed to avoid this economic condition.)You must use numbers that you calculated above to support your answer to receive credit.
g) Explain how the Fed would use two other monetary tools to help support its Open Market Operation above. Explain how these tools would be used and how they would have an impact on the Marcoeconomy.
In: Economics
Instructions:: In this assignment,you will calculate confidence intervals for the quantitative variables in the Heart Rate database.
Steps:
1. Open the Heart Rate database in Excel and identify the quantitative variables
2. Make sure the data is sorted by category, e.g., male at-rest, female at-rest, etc.
3. Use the Data Analysis tools to construct 95% and 99% confidence intervals for all of the sorted quantitative variables. Please note that the statistic being used is the confidence interval of the means, which requires the use of the Standard Error of the mean (not the standard deviation of the mean)
4. Create a Word document, using your calculated Excel results, to describe the expected value and range for each of the variables. Make certain you note and explain any differences in the means of the variables, and any effect of changing the level of confidence.
Heart Rate Database
| Heart rate before and after exercise | ||
| M=0 F=1 | Resting | After Exercise |
| 0 | 85.9 | 87.5 |
| 0 | 67.7 | 79.4 |
| 0 | 80.3 | 93.4 |
| 0 | 85.2 | 97.7 |
| 0 | 86.3 | 99.7 |
| 0 | 76.6 | 83.7 |
| 0 | 94.4 | 101.9 |
| 0 | 86.4 | 100.6 |
| 0 | 83.4 | 97.4 |
| 0 | 89.8 | 97.4 |
| 0 | 88.7 | 97.1 |
| 0 | 78.4 | 87.2 |
| 0 | 71.3 | 79.9 |
| 0 | 92.6 | 104.7 |
| 0 | 86.2 | 95.9 |
| 0 | 83.9 | 93.9 |
| 0 | 78.1 | 90.1 |
| 0 | 64.0 | 70.7 |
| 0 | 72.8 | 86.7 |
| 0 | 72.7 | 81.2 |
| 0 | 80.2 | 83.3 |
| 0 | 78.2 | 86.0 |
| 0 | 70.6 | 90.2 |
| 0 | 75.5 | 84.4 |
| 0 | 82.7 | 94.2 |
| 0 | 87.7 | 95.1 |
| 0 | 80.0 | 88.7 |
| 0 | 73.4 | 82.7 |
| 0 | 89.5 | 94.6 |
| 0 | 77.6 | 84.6 |
| 0 | 76.6 | 86.4 |
| 0 | 85.6 | 96.2 |
| 0 | 74.2 | 82.1 |
| 0 | 79.0 | 91.6 |
| 0 | 74.6 | 86.7 |
| 0 | 88.8 | 98.8 |
| 0 | 82.1 | 85.6 |
| 0 | 77.6 | 80.6 |
| 0 | 77.9 | 83.8 |
| 0 | 88.1 | 93.9 |
| 0 | 81.6 | 90.3 |
| 0 | 91.2 | 100.6 |
| 0 | 80.3 | 88.0 |
| 0 | 76.7 | 91.8 |
| 0 | 88.4 | 103.0 |
| 0 | 75.2 | 86.5 |
| 0 | 75.2 | 84.9 |
| 0 | 73.1 | 71.9 |
| 0 | 77.0 | 84.7 |
| 0 | 59.0 | 68.2 |
| 0 | 84.9 | 96.0 |
| 0 | 87.5 | 105.9 |
| 0 | 75.6 | 84.3 |
| 0 | 84.0 | 90.4 |
| 0 | 78.2 | 94.0 |
| 0 | 86.6 | 90.6 |
| 0 | 84.9 | 95.1 |
| 0 | 78.8 | 90.4 |
| 0 | 69.4 | 82.6 |
| 0 | 78.3 | 91.1 |
| 0 | 76.9 | 92.3 |
| 0 | 84.2 | 87.9 |
| 0 | 76.3 | 85.9 |
| 0 | 86.3 | 99.7 |
| 0 | 72.3 | 80.9 |
| 0 | 81.8 | 93.8 |
| 0 | 92.8 | 99.8 |
| 0 | 74.8 | 90.2 |
| 0 | 91.7 | 99.2 |
| 0 | 71.0 | 87.0 |
| 0 | 96.1 | 100.2 |
| 0 | 82.5 | 95.1 |
| 0 | 81.9 | 97.5 |
| 0 | 89.7 | 94.8 |
| 0 | 81.4 | 100.9 |
| 0 | 74.8 | 94.0 |
| 0 | 88.1 | 102.1 |
| 0 | 69.2 | 81.4 |
| 0 | 78.8 | 90.9 |
| 0 | 85.3 | 94.2 |
| 0 | 74.8 | 81.3 |
| 0 | 77.7 | 89.9 |
| 0 | 78.0 | 89.8 |
| 0 | 80.5 | 95.3 |
| 0 | 75.4 | 84.8 |
| 0 | 81.5 | 84.2 |
| 0 | 73.9 | 85.2 |
| 0 | 69.4 | 74.1 |
| 0 | 89.4 | 96.7 |
| 0 | 70.9 | 82.0 |
| 0 | 82.9 | 90.2 |
| 0 | 89.6 | 106.7 |
| 0 | 74.5 | 75.6 |
| 0 | 92.3 | 102.2 |
| 0 | 87.7 | 98.0 |
| 0 | 78.9 | 89.7 |
| 0 | 79.8 | 81.5 |
| 0 | 85.5 | 97.4 |
| 0 | 87.3 | 94.1 |
| 0 | 77.8 | 97.8 |
| 0 | 71.0 | 80.1 |
| 0 | 82.5 | 90.7 |
| 0 | 74.8 | 83.7 |
| 0 | 69.2 | 79.4 |
| 0 | 80.5 | 87.4 |
| 0 | 89.4 | 99.2 |
| 0 | 74.5 | 88.0 |
| 0 | 85.5 | 92.0 |
| 1 | 76.6 | 88.2 |
| 1 | 79.2 | 90.4 |
| 1 | 80.6 | 101.3 |
| 1 | 75.5 | 93.1 |
| 1 | 83.9 | 90.5 |
| 1 | 73.9 | 89.1 |
| 1 | 76.8 | 90.8 |
| 1 | 85.2 | 93.5 |
| 1 | 82.1 | 93.5 |
| 1 | 76.3 | 87.0 |
| 1 | 97.0 | 104.5 |
| 1 | 81.5 | 86.5 |
| 1 | 65.3 | 86.3 |
| 1 | 80.8 | 86.7 |
| 1 | 78.5 | 89.9 |
| 1 | 86.3 | 97.6 |
| 1 | 89.8 | 92.9 |
| 1 | 87.8 | 98.5 |
| 1 | 76.2 | 89.9 |
| 1 | 74.2 | 88.8 |
| 1 | 67.4 | 78.8 |
| 1 | 75.5 | 80.2 |
| 1 | 80.0 | 90.2 |
| 1 | 76.4 | 88.0 |
| 1 | 94.9 | 95.7 |
| 1 | 89.2 | 96.9 |
| 1 | 83.3 | 87.7 |
| 1 | 85.8 | 90.4 |
| 1 | 75.3 | 84.1 |
| 1 | 77.9 | 99.0 |
| 1 | 70.0 | 83.0 |
| 1 | 88.0 | 94.2 |
| 1 | 86.9 | 95.0 |
| 1 | 87.1 | 95.9 |
| 1 | 79.3 | 82.7 |
| 1 | 81.2 | 90.7 |
| 1 | 82.9 | 91.9 |
| 1 | 87.4 | 103.6 |
| 1 | 83.0 | 90.0 |
| 1 | 76.8 | 83.3 |
| 1 | 76.9 | 87.7 |
| 1 | 79.8 | 88.2 |
| 1 | 83.2 | 93.0 |
| 1 | 79.5 | 88.6 |
| 1 | 82.4 | 89.3 |
| 1 | 80.8 | 84.2 |
| 1 | 83.2 | 94.5 |
| 1 | 71.6 | 81.5 |
| 1 | 82.8 | 93.1 |
| 1 | 76.8 | 92.8 |
| 1 | 93.2 | 100.4 |
| 1 | 91.4 | 100.9 |
| 1 | 97.3 | 103.3 |
| 1 | 88.3 | 90.1 |
| 1 | 80.6 | 85.2 |
| 1 | 87.4 | 91.7 |
| 1 | 96.5 | 99.3 |
| 1 | 77.9 | 91.6 |
| 1 | 76.1 | 84.1 |
| 1 | 85.2 | 89.7 |
| 1 | 68.6 | 72.8 |
| 1 | 79.4 | 92.0 |
| 1 | 85.2 | 99.2 |
| 1 | 74.3 | 85.6 |
| 1 | 74.3 | 89.2 |
| 1 | 78.5 | 98.5 |
| 1 | 80.4 | 90.8 |
| 1 | 82.9 | 85.9 |
| 1 | 78.9 | 90.7 |
| 1 | 78.6 | 87.0 |
| 1 | 87.5 | 93.9 |
| 1 | 78.9 | 91.4 |
| 1 | 80.0 | 89.1 |
| 1 | 80.4 | 89.2 |
| 1 | 88.3 | 93.5 |
| 1 | 80.6 | 95.9 |
| 1 | 85.8 | 90.5 |
| 1 | 84.6 | 93.0 |
| 1 | 80.5 | 91.8 |
| 1 | 92.4 | 101.2 |
| 1 | 84.4 | 96.7 |
| 1 | 82.3 | 86.9 |
| 1 | 77.2 | 85.8 |
| 1 | 83.3 | 82.1 |
| 1 | 86.2 | 98.9 |
| 1 | 81.3 | 97.7 |
| 1 | 90.2 | 96.4 |
| 1 | 78.4 | 85.5 |
| 1 | 84.7 | 101.6 |
| 1 | 89.7 | 94.3 |
| 1 | 78.4 | 88.0 |
| 1 | 79.9 |
88.5 |
In: Statistics and Probability
When the Law of Supply and Demand Isnât Fair
By Richard Thaler
For an economist, one of the most jarring sights during the early weeks of the coronavirus crisis in the United States was the spectacle of bare shelves in sections of the supermarket.
There was no toilet paper or hand sanitizer. Pasta, flour and even yeast could be hard to find in the early weeks of social distancing, as many people decided to take up baking. Of far greater concern, hospitals could not buy enough of the masks, gowns and ventilators required to safely treat Covid-19 patients.
What happened to the laws of supply and demand? Why didnât prices rise enough to clear the market, as economic models predict?
A paper that I wrote with my friends Daniel Kahneman, a psychologist, and Jack Knetsch, an economist, explored this problem. We found that the answer may be summed up with a single word, one you wonât find in the standard supply-and-demand models: fairness. Basically, it just isnât socially acceptable to raise prices in an emergency.
We asked people questions about the actions of hypothetical firms. For example: âA hardware store has been selling snow shovels for $15. The morning after a blizzard the store raises the price of snow shovels to $20.â
Fully 82 percent of our respondents judged this to be unfair. The respondents were Canadians, known for their politeness, but the general findings have now been replicated and confirmed in studies around the world.
Most companies implicitly understand that abiding by the social norms of fairness should be part of their business model. In the current crisis, large retail chains have responded to the shortages of toilet paper not by raising the price but by limiting the amount each customer can buy. And Amazon and eBay prohibited what was viewed as price gouging on their sites.
We have seen similar behavior after hurricanes. As soon as a storm ends, there is typically enormous demand for goods like bottled water and plywood. Big retailers like Home Depot and Walmart anticipate this, sending trucks loaded with supplies to regions just outside the danger zone, ready to be deployed. Then, when it is safe, the stores provide water for free and sell the plywood at the list price or lower.
At the same time, some âentrepreneursâ are likely to behave differently. They see a disaster as an opportunity and so will fill up trucks with plywood near their homes, drive to the storm site and sell their goods for whatever price they can get.
It is not that large retailers are intrinsically more ethical than the entrepreneurs; it is simply that they have different time horizons. The large companies are playing a long game, and by behaving âfairlyâ they are hoping to retain customer loyalty after the emergency. The entrepreneurs are just interested in a quick buck.
Fairness norms help explain the breakdown of supply chains of medical equipment in the coronavirus crisis. Hospitals normally use buying associations that make long-term deals with wholesalers to provide essential supplies. The wholesalers generally want to preserve these relationships and realize that now would not be a good time to raise prices. Often, they are contractually obligated to supply items at prices negotiated before a spike in demand.
One current example is the N95 face mask. At the onset of the pandemic, hospitals had long-term contracts to buy them for about 35 cents each, an executive at a New York hospital told me. When the need for the masks surged, these suppliers were not allowed to raise the price, even if inclined to do so.
But others along the supply chain could make big profits by diverting masks to anyone willing to pay top dollar. That left hospitals in a bind. As the coronavirus spread in New York, the executiveâs hospital searched frantically for masks, eventually paying an overseas supplier $6 each, for hundreds of thousands of them, when the regular stock was desperately short.
When anyone tries to reap big profits in an emergency like this, it can look ugly. Consider the case of two brothers who began buying hand sanitizer, masks and other scarce commodities on March 1, the day of the first announcement of a Covid-19 death in the United States. After they sold some of their merchandise at big markups on Amazon and eBay, these outlets cut them off. Eventually, after considerable adverse publicity, the brothers decided to donate their supplies.
Notice that the brothers were making markets more âefficient,â by buying low and selling high. If instead of arbitraging coronavirus supplies they had sold shares of airline and hotel companies and bought shares of Netflix and Zoom, they would simply have been considered smart traders. But while smart trading may be fine for investments, it is not considered fair when it involves essential goods during a pandemic.
One can argue that this social norm is harmful in that it prevents markets from doing their magic. For example, Tyler Cowen, the George Mason University economist, has said he wishes it were OK to raise prices for coronavirus essentials.
âHigher prices discourage panic buying and increase the chance that the people who truly need particular goods and services have a greater chance of getting them,â he wrote.
But which people âtruly needâ N95 masks? What is the right allocation of masks among well-endowed research hospitals, poorly funded municipal facilities, nursing homes and food processing plants? Supply and demand would tell us that the masks should simply go to the buyer who was willing and able to pay the most for them. But fairness tells us this canât be the only consideration.
As a practical matter for businesses, big and small, that want to keep operating for the long haul, it makes good sense to obey the law of fairness. If the next shortage is meat and a store owner realizes that there is only one package of pork chops left, it would be unwise sell it at auction to the highest bidder.
Richard H. Thaler is a professor of economics and behavioral science at the Booth School of Business at the University of Chicago. Follow him on Twitter: @R_Thaler
Economic Concepts:
scarcity implies competition
ethics
allocation mechanisms
trade-offs
COMMENT
In: Economics
Write the following java program:
Desc Output the name and time of the runner who came in first, as
well as the name and time of
the runner who came in last in a marathon race (assuming there are
no ties).
Input A text file named marathon.txt containing the name and time
of each participant in the
following format (the file has at least 1 participant, name is just
1 word with no space, and name
and time are separated by tabs, blanks, and newlines):
John 2:40
Paul 3:20
Carl 2:10
Output The name and time of the runner who came in first, as well
as the name and time of the
runner who came in last printed to the screen.
You must define a class called Runner. Here is the API of
Runner:
A Runner object stores the name of a runner (String) and his
raceTime (Time24).
Methods:
a. Usage: Runner()
Post: The Runner object initialized with name="unknown" and
raceTime=0:0.
b. Usage: Runner (String s, Time24 t)
Post: The Runner object initialized with name=s and
raceTime=t.
c. Usage: String getName()
Return: The name of the Runner object
d. Usage: Time24 getRaceTime()
Return: The raceTime of the Runner object.
e. Usage: void setName(String s)
Post: The Runner object's name set to s
f. Usage: void setRaceTime(Time24 t)
Post: The Runner object's raceTime set to t
g. Usage: void read(Scanner f)
Pre: f has a line in the following format ready to be read:
name hh:mm
where name is a String and hh, mm are integers. The token
delimiters of f have
been set to white space characters and the colon by the
caller.
Post: The line read in from f, the name and the time stored in the
Runner object
h. Usage: int compareTo(Runner r)
Desc: Compare 2 Runner objects based on raceTime
Return: 1 if current object's raceTime > r's raceTime
0 if current object's raceTime == r's raceTime
-1 if current object's raceTime < r's raceTime
i. Usage: String toString()
Return: A String object in the form "name hh:mm"
Note:
ï· It is not necessary to save all the runners in an array or a
vector (you only need to find the minimum
time and the maximum time).
Hand in:
ï· Marathon.java with 2 classes: Runner, and Marathon (use class
Time24).
//Time24.java
import java.util.StringTokenizer;
import java.text.DecimalFormat;
/**
A data structure that stores integer values for hour (0..23) and minute (0..59) to represent the time of day in a 24-hour clock
*/
public class Time24
{
private int hour;
private int minute;
//Post: Sets the hour value in the range 0 to 23 and the minute value in the range 0 to 59
private void normalizeTime()
{
int extraHours = minute / 60;
minute %= 60;
hour = (hour + extraHours) % 24;
}
/**
Desc:Initializes this Time24 object
Post:hour and minute of this Time24 object both initialized to 0
*/
public Time24()
{
this(0,0); //calls the 2-argument constructor of class Time24
}
/**
Desc:Initializes this Time24 object
Pre:h and m cannot be negative
Post:hour and minute of this Time24 object initialized to h and m
respectively. This operation will normalize the time if necessary (e.g.
9:75 is stored as 10:15).
Throw:IllegalArgumentException if h or m is negative
*/
public Time24(int h, int m)
{
setTime(h, m);
}
/**
Desc:Sets the hour and minute of this Time24 object to a particular time
Pre:h and m cannot be negative
Post:hour and minute of this Time24 object set to h and m
respectively. This operation will normalize the time if necessary (e.g.
9:75 is stored as 10:15).
Throw:IllegalArgumentException if h or m is negative
*/
public void setTime(int h, int m)
{
if (h < 0 || m < 0)
throw new IllegalArgumentException("Time24.setTime: argument"
+ " must not be negative");
this.hour = h;
this.minute = m;
normalizeTime();
}
/**
Desc:Adds minutes to this Time24 object
Pre:m cannot be negative
Post:This Time24 object set to m minutes later. This operation will
normalize the time if necessary (e.g. 9:75 is stored as 10:15).
Throw:IllegalArgumentException if m is negative
*/
public void addTime(int m)
{
if (m < 0)
throw new IllegalArgumentException("Time24.addTime: argument"
+ " must not be negative");
minute += m;
normalizeTime();
}
/**
Desc:Measures the interval from this Time24 object to another time
Return:The interval from this Time24 object to t as a Time24
*/
public Time24 interval(Time24 t)
{
int currTime = hour * 60 + minute;
int tTime = t.hour * 60 + t.minute;
if (tTime < currTime) tTime += 24 * 60;
return new Time24(0, tTime-currTime);
}
/**
Desc:Gets the hour value of this Time24 object
Return:The hour value of this Time24 object
*/
public int getHour()
{
return hour;
}
/**
Desc:Gets the minute value of this Time24 object
Return:The minute value of this Time24 object
*/
public int getMinute()
{
return minute;
}
/**
Desc:Converts this Time24 object to a string
Return:This Time24 object as a String in the form "hh:mm"
*/
public String toString()
{
DecimalFormat f = new DecimalFormat("00");
return hour + ":" + f.format(minute);
}
/**
Desc:Convert a String to a Time24
Pre:s must be in the form "hh:mm" where hh and mm are positive integers
Return:A Time24 object that corresponds to s
*/
public static Time24 parseTime(String s)
{
StringTokenizer t = new StringTokenizer(s, ":");
int h = Integer.parseInt(t.nextToken());
int m = Integer.parseInt(t.nextToken());
return new Time24(h, m);
}
}
Hint:
class Runner
{
private String name;
private Time24 raceTime;
public Runner()
{
name="unknown";
raceTime=new Time24(0,0);
}
public Runner(String s, Time24 t)
{
name=s;
raceTime=new Time24(t.getHour(), t.getMinute());
}
public String getName()
{
return name;
}
public Time24 getRaceTime()
{
return new Time24(raceTime.getHour(),
raceTime.getMinute());
}
âŠâŠ
}
class Marathon
{
public static void main(String[] args) throws
FileNotFoundException
{
âŠâŠ.
}
}
In: Computer Science
| INTD 5064/OCCT 5023 - Applied Statistics for Health Care Practitioners | |||||||
| Magnets and Pain Relief Data Set | |||||||
| Magnet Treatment Group | Placebo Group | ||||||
| Subject | Before | After | Subject | Before | After | ||
| AM | 10 | 10 | LL | 8 | 4 | ||
| AA | 10 | 4 | LM | 10 | 7 | ||
| BC | 8 | 7 | MD | 10 | 5 | ||
| BR | 10 | 0 | MN | 10 | 8 | ||
| CM | 10 | 4 | JJ | 9 | 8 | ||
| FW | 10 | 2 | JA | 10 | 6 | ||
| GM | 10 | 5 | CR | 9 | 8 | ||
| GD | 10 | 5 | WT | 10 | 10 | ||
| HB | 9 | 3 | GJ | 10 | 10 | ||
| MG | 10 | 10 | BD | 7 | 6 | ||
| PD | 9 | 2 | EG | 10 | 10 | ||
| RW | 10 | 2 | RB | 8 | 8 | ||
| SF | 10 | 3 | DO | 10 | 10 | ||
| TS | 10 | 4 | DS | 10 | 10 | ||
| WA | 10 | 10 | NP | 10 | 10 | ||
| SH | 8 | 4 | GE | 10 | 10 | ||
| WK | 10 | 3 | DY | 9 | 9 | ||
| MR | 10 | 0 | KU | 10 | 9 | ||
| MS | 8 | 2 | UT | 10 | 10 | ||
| AR | 8 | 7 | AX | 10 | 10 | ||
| TN
INTD 5064 â Applied Statistics for Health Care Practitioners t-test Homework For the items below, download the data set Magnets and Pain Relief Data Set. These data are a subset of data in a study by Vallbona, C., et al. Response of pain to static magnetic fields in postpolio patients: A double blind pilot study. Archives of Physical Medicine and Rehabilitation, (78), 1200-1203. In the original study, the researchers sought to answer the question âCan chronic pain experienced by postpolio patients be relieved by magnetic fields applied directly over an identified pain trigger point?â Subjects in the Treatment Group had a magnetic device applied to the site of pain for 45 minutes. Subjects in the Placebo Group had a non-magnetic device applied for 45 minutes. All subjects reported their pain before and after the experiment using a 0 to 10 scale (0 was the least pain, and 10 was the greatest pain). The data consist of self-report pain scores recorded before and after the experiment. This homework includes three opportunities to calculate obtained t values: 3.c., 5.e., and 7.b. Two of these items (3.c. and 5.e.) are highlighted. Choose one of the highlighted items to complete (3.c. OR 5.e.). All non-highlighted items are required (including 7.b.). What is/are the dependent variable(s) in the study? the independent variable(s)? Include the scales of measurement. Calculate appropriate measures of central tendency and variability for each variable you will need in this assignment, i.e., âbeforeâ and/or âafterâ pain scores for each group. Justify your choices. You may use Excel to calculate measures of central tendency and variability. A link has been provided for support in doing so. However, you may calculate those by hand or with a scientific calculator as well. The researchers anticipated that Magnet Treatment Group pain scores would be lower than Placebo Group pain scores at the end of the study. Write the null hypothesis, in prose and notation. (Pay close attention to the word âlowerâ in this exercise. Remember that lower scores indicate less pain and, thus, effectiveness of the magnets. What does this suggest for how the hypotheses are stated and for how the t distribution diagram is drawn?) a.Is the null hypothesis stated above one-tailed or two-tailed?Justify your answer. b.What type of test should be used to test the null hypothesis stated?Justify your answer. c.Using the A-B-C-D format, test the null hypothesis. (Use ? = .05) The researchers wanted to know whether there was a difference in average pain levels for the Magnet Treatment Group and the Placebo Group at the beginning of the experiment. Why would it be reasonable and desirable to show that there were no differences? a.Write the null and alternate hypotheses, in prose and notation. b.Is the null hypothesis one-tailed or two-tailed?Justify your answer. c.What conclusions would you draw if the null hypothesis were rejected? d.What type of t test should be used to test the hypothesis?Justify your answer. Murphy, another investigator who had used another type of magnet, obtained patterns of results that resembled Vallbonaâs results. After the experiment with 21 subjects, Murphyâs treatment groupâs mean pain score was 5.50, and the standard deviation was 2.50. Murphy wished to test whether his âAfterâ mean was greater than Vallbonaâs âAfterâ mean. Why would Murphy be interested in conducting this test? What information would this test provide? Without testing any formal hypotheses, what do the data suggest about differences between Murphyâs âAfterâ mean and Valbonaâs âAfterâ mean? Justify your answer. Is the null hypothesis suggested above one-tailed or two-tailed? Justify your answer. What type of inferential test should Murphy use to test the hypothesis? Justify your answer. HINT: In this case, Murphy chose to use Vallbonaâs mean as a hypothesized value. Using the A-B-C-D format demonstrated in class, test the null hypothesis that you stated in exercise 3d. (Use ? = .05) Think of a research question that would be appropriate for an independent-samples t-test. Share: The research question Hypotheses in prose and notation. The conclusion you would make if the null hypothesis were rejected. Complete a t-test using the data collected during the first week of class (i.e., the question you asked classmates). You can compare groups via gender or major, depending on your hypothesis. For example, as I mentioned, last year an MLS student asked his classmates how many times they had seen Star Wars. He hypothesized that there was a significant difference between MLS and DEHS students, so he compared those two groups. What type of inferential test should you use and why? Using the A-B-C-D format demonstrated in class, test the null hypothesis. (Use ? = .05) |
10 | 4 | PW | 10 | 9 |
|
|
In: Statistics and Probability
In: Accounting
| Data Set 3 --Buena School District Bus Data | ||||||
| Bus Number | Maintenance | Age | Miles | Type | Bus-Mfg | Passenger |
| X1 | X2 | X3 | X4 | X5 | X6 | X7 |
| 135 | 329 | 7 | 853 | Diesel | Bluebird | 55 Passenger |
| 200 | 505 | 10 | 822 | Diesel | Bluebird | 55 Passenger |
| 40 | 466 | 10 | 865 | Gasoline | Bluebird | 55 Passenger |
| 387 | 422 | 8 | 869 | Gasoline | Bluebird | 55 Passenger |
| 326 | 433 | 9 | 848 | Diesel | Bluebird | 55 Passenger |
| 861 | 474 | 10 | 845 | Gasoline | Bluebird | 55 Passenger |
| 122 | 558 | 10 | 885 | Gasoline | Bluebird | 55 Passenger |
| 887 | 357 | 8 | 760 | Diesel | Bluebird | 6 Passenger |
| 686 | 329 | 3 | 741 | Diesel | Bluebird | 55 Passenger |
| 490 | 497 | 10 | 859 | Gasoline | Bluebird | 55 Passenger |
| 464 | 355 | 3 | 806 | Gasoline | Bluebird | 55 Passenger |
| 875 | 489 | 9 | 858 | Diesel | Bluebird | 55 Passenger |
| 883 | 436 | 2 | 785 | Gasoline | Bluebird | 55 Passenger |
| 57 | 455 | 7 | 828 | Diesel | Bluebird | 55 Passenger |
| 482 | 514 | 11 | 980 | Gasoline | Bluebird | 55 Passenger |
| 704 | 503 | 8 | 857 | Diesel | Bluebird | 55 Passenger |
| 731 | 432 | 6 | 819 | Diesel | Bluebird | 42 Passenger |
| 75 | 478 | 6 | 821 | Diesel | Bluebird | 55 Passenger |
| 600 | 493 | 10 | 1008 | Diesel | Bluebird | 55 Passenger |
| 358 | 461 | 6 | 849 | Diesel | Bluebird | 55 Passenger |
| 692 | 469 | 8 | 812 | Diesel | Bluebird | 55 Passenger |
| 43 | 439 | 9 | 832 | Gasoline | Bluebird | 55 Passenger |
| 500 | 369 | 5 | 842 | Gasoline | Bluebird | 55 Passenger |
| 279 | 390 | 2 | 792 | Diesel | Bluebird | 55 Passenger |
| 884 | 381 | 9 | 882 | Diesel | Bluebird | 55 Passenger |
| 977 | 501 | 7 | 874 | Diesel | Bluebird | 55 Passenger |
| 725 | 392 | 5 | 774 | Diesel | Bluebird | 55 Passenger |
| 982 | 441 | 1 | 823 | Diesel | Bluebird | 55 Passenger |
| 39 | 411 | 6 | 804 | Gasoline | Bluebird | 55 Passenger |
| 418 | 504 | 9 | 842 | Diesel | Bluebird | 55 Passenger |
| 984 | 392 | 8 | 851 | Diesel | Bluebird | 55 Passenger |
| 953 | 423 | 10 | 835 | Diesel | Bluebird | 55 Passenger |
| 507 | 410 | 7 | 866 | Diesel | Bluebird | 55 Passenger |
| 540 | 529 | 4 | 846 | Gasoline | Bluebird | 55 Passenger |
| 695 | 477 | 2 | 802 | Diesel | Bluebird | 55 Passenger |
| 321 | 450 | 6 | 856 | Diesel | Bluebird | 6 Passenger |
| 918 | 390 | 5 | 799 | Diesel | Bluebird | 55 Passenger |
| 101 | 424 | 4 | 827 | Diesel | Bluebird | 55 Passenger |
| 714 | 433 | 7 | 817 | Diesel | Bluebird | 42 Passenger |
| 768 | 494 | 7 | 815 | Diesel | Bluebird | 42 Passenger |
| 29 | 396 | 6 | 784 | Gasoline | Bluebird | 55 Passenger |
| 554 | 458 | 4 | 817 | Diesel | Bluebird | 14 Passenger |
| 699 | 475 | 9 | 816 | Gasoline | Bluebird | 55 Passenger |
| 954 | 476 | 10 | 827 | Diesel | Bluebird | 42 Passenger |
| 660 | 337 | 6 | 819 | Gasoline | Bluebird | 55 Passenger |
| 520 | 492 | 10 | 836 | Diesel | Bluebird | 55 Passenger |
| 814 | 426 | 4 | 757 | Diesel | Bluebird | 55 Passenger |
| 120 | 503 | 10 | 883 | Diesel | Keiser | 42 Passenger |
| 427 | 359 | 7 | 751 | Gasoline | Keiser | 55 Passenger |
| 759 | 546 | 8 | 870 | Diesel | Keiser | 55 Passenger |
| 10 | 427 | 5 | 780 | Gasoline | Keiser | 14 Passenger |
| 880 | 474 | 9 | 857 | Gasoline | Keiser | 55 Passenger |
| 481 | 382 | 3 | 818 | Gasoline | Keiser | 6 Passenger |
| 370 | 459 | 8 | 826 | Gasoline | Keiser | 55 Passenger |
| 989 | 380 | 9 | 803 | Diesel | Keiser | 55 Passenger |
| 162 | 406 | 3 | 798 | Gasoline | Keiser | 55 Passenger |
| 732 | 471 | 9 | 815 | Diesel | Keiser | 42 Passenger |
| 751 | 444 | 2 | 757 | Diesel | Keiser | 14 Passenger |
| 948 | 452 | 9 | 831 | Diesel | Keiser | 42 Passenger |
| 61 | 442 | 9 | 809 | Diesel | Keiser | 55 Passenger |
| 9 | 414 | 4 | 864 | Gasoline | Keiser | 55 Passenger |
| 365 | 462 | 6 | 799 | Diesel | Keiser | 55 Passenger |
| 693 | 469 | 9 | 775 | Gasoline | Keiser | 55 Passenger |
| 38 | 432 | 6 | 837 | Gasoline | Keiser | 14 Passenger |
| 724 | 448 | 8 | 790 | Diesel | Keiser | 42 Passenger |
| 603 | 468 | 4 | 800 | Diesel | Keiser | 14 Passenger |
| 45 | 478 | 6 | 830 | Diesel | Keiser | 55 Passenger |
| 754 | 515 | 14 | 895 | Diesel | Keiser | 14 Passenger |
| 678 | 428 | 7 | 842 | Diesel | Keiser | 55 Passenger |
| 767 | 493 | 6 | 816 | Diesel | Keiser | 55 Passenger |
| 705 | 403 | 4 | 806 | Diesel | Keiser | 42 Passenger |
| 353 | 449 | 4 | 817 | Gasoline | Keiser | 55 Passenger |
| 156 | 561 | 12 | 838 | Diesel | Thompson | 55 Passenger |
| 833 | 496 | 8 | 839 | Diesel | Thompson | 55 Passenger |
| 314 | 459 | 11 | 859 | Diesel | Thompson | 6 Passenger |
| 396 | 457 | 2 | 815 | Diesel | Thompson | 55 Passenger |
| 398 | 570 | 9 | 844 | Diesel | Thompson | 14 Passenger |
| 168 | 467 | 7 | 827 | Gasoline | Thompson | 55 Passenger |
| 671 | 504 | 8 | 866 | Gasoline | Thompson | 55 Passenger |
| 193 | 540 | 11 | 847 | Diesel | Thompson | 55 Passenger |
The attached MS-Excel file contains data on the contains data the bus fleet of the Buena School district. Download the file and analyze the characteristics of the Buena Bus fleet.
In: Accounting
Assignment 4 You will be writing an inventory system that is
backed by JSON data and will be working with a starter file that
contains a JSON string. The code you write will need to follow the
following guidelines.
Youâre at work one day and your boss asks you about that fancy
programming language youâve been learning, Python. She asks you if
you can use it to read JSON data from a supplier and build an
inventory. âOf course!â you say. She tells you that your parts
supplier, Midwest Widget Co, has sent the company JSON data that
needs to be loaded and then checked against orders. Youâll need to
load the JSON data, and then take input from a user to order new
parts. If the part is not in stock, or the number of parts is
greater than the available inventory, you need to alert the user
and show them that its either out of stock or that there are less
available than requested. Once the user is done entering in their
order, youâll need to package up their order in JSON format, since
thatâs what Midwestern Widget Co uses after all!
The JSON data is comprised of a few nested dictionaries. In the
top level, there is a key called âpartsâ that maps to a list that
contains all the parts available for ordering. Each of those parts
is also a key into the dictionary. That key maps to dictionary that
has two values, quantity and price. The quantity maps to an integer
with the number of parts available for order, the price maps to a
float with the price of the part. A sample JSON object is provided
below:
{
"parts":[
"widget",
"sprocket",
"thing-a-ma-bob"
],
"widget":{
"price":0.99,
"quantity":74
},
"sprocket":{
"price":3.99,
"quantity":123
},
"thing-a-ma-bob":{
"price":1.78,
"quantity":57
}
}
The strings in the list in parts are the keys for the rest of the data in the dictionary. Those keys map to separate dictionaries with the prices and quantities. The json string is provided in the code, it is called supplier_data.
The ordering system will work like this:
Prompt the user for input, and indicate they can enter in the word âquitâ to quit. The user should enter in a part and then the quantity on two separate lines (so youâll need two input statements). After both pieces of information have been entered in, check if the order is allowed or not, and display an error message with the appropriate information (part doesnât exist, part exists but not enough quantity). If the order is valid, store it and continue. Once the user enters quit, print out an order summary showing the part, number ordered, the price per part and total per part with a grand total at the end. The order data MUST be stored in a dictionary. You must also allow the user to order a part more than once and validate that both orders are not exceeding the total amount available!
Sample Output:
Your program should produce output that is very similar if not identical to this. Major deviations from the formatting will result in points lost. The error handling behavior should be the same.
Welcome to the parts ordering system, please enter in a part name, followed by a quantity
Parts for order are:
sprocket
gizmo
widget
dodad
Please enter in a part name, or quit to exit: blargh
Error, part does not exist, try again
Please enter in a part name, or quit to exit: quit
Your order Total: $0
Thank you for using the parts ordering system!
And another run with an actual order
Welcome to the parts ordering system, please enter in a part name, followed by a quantity
Parts for order are:
sprocket
gizmo
widget
dodad
Please enter in a part name, or quit to exit: gizmo
Please enter in a quantity to order: 1000
Error, only 2 of gizmo are available!
Please enter in a part name, or quit to exit: gizmo
Please enter in a quantity to order: 1
Please enter in a part name, or quit to exit: sprocket
Please enter in a quantity to order: 15
Please enter in a part name, or quit to exit: widget
Please enter in a quantity to order: 1
Please enter in a part name, or quit to exit: quit
Your order
gizmo - 1 @ 7.98 = 7.98
sprocket - 15 @ 3.99 = 59.85
widget - 1 @ 14.32 = 14.32
Total: $82.15
Thank you for using the parts ordering system!
Another run with multiple orders for a single part
Welcome to the parts ordering system, please enter in a part name, followed by a quantity
Parts for order are:
sprocket
gizmo
widget
dodad
Please enter in a part name, or quit to exit: gizmo
Please enter in a quantity to order: 2
Please enter in a part name, or quit to exit: gizmo
Please enter in a quantity to order: 2
Error, only 0 of gizmo are available!
Please enter in a part name, or quit to exit: quit
Your order
gizmo - 2 @ 7.98 = 15.96
Total: $15.96
Thank you for using the parts ordering system!
Tips and Hints 1. Start on something small and get it working before moving on. Donât try and tackle it all at once! 2. Youâll need to validate the input between inputs 3. You can use print() with no arguments to print out extra blank lines 4. A while loop is ideal for the main program loop 5. Youâll need to check if a part has already been ordered before checking if sufficient quantity is available. If it has been ordered, youâll need to account for that when checking the inventory levels 6. supplier_data in the provided code is a JSON string. You need to convert it to a dict with json.loads
**CODE TEMPLATE**
# Program header goes here
#
#
#
supplier_data = '{"parts": ["sprocket", "gizmo", "widget",
"dodad"], "sprocket": {"price": 3.99, "quantity": 32}, "gizmo":
{"price": 7.98, "quantity": 2}, "widget": {"price": 14.32,
"quantity": 4}, "dodad": {"price": 0.5, "quantity": 0}}'
# Your code goes here
In: Computer Science