Programming assignment 9
Write a function sortWords(array) that does the following:
1. Takes as an input a cell array of strings consisting of letters
only. (1 pts)
2. Returns a cell array with all the strings in alphabetical order.
(5 pts)
3. The function should ignore whether letters are lower case or
upper case. (2 pts)
Test your function with the following: (2 pts)
>>
sorted=sortWords({’Hello’,’hell’,’abc’,’aa’,’aza’,’aab’,’AaBb’,’a’})
sorted =
’a’ ’aa’ ’aab’ ’AaBb’ ’abc’ ’aza’ ’hell’ ’Hello’
Note: Your function may not contain any built-in MATLAB function(s)
that deal with sorting or finding minimum values. If your function
does use these built-in functions, up to 8 points may be deducted
from your total.
Hint: Use the program sharkSort(vec) as a starting point and amend
it so that it works for this programming assignment. For example
your function could start as follows (fill in the blanks as
necessary):
function sortedarray=sortWords(array) sortedarray={}; while
~isempty(array) [m,pos]=findSmallest(array); array(pos)=[];
sortedarray=[sortedarray m]; end
function [m,pos]=findSmallest(array) m = ...; pos=1; for
i=2:length(array) if isLessWord(...,m) m = ...; pos= i; end
end
function less=isLessWord(wordA,wordB) worda=lower(wordA);
wordb=lower(wordB);
In: Computer Science
Related to Checkpoint 13.5) (Real options and capital budgeting) You are considering introducing a new Tex-Mex-Thai fusion restaurant. The initial outlay on this new restaurant is
$6.96.9
million and the present value of the free cash flows (excluding the initial outlay) is
$5.35.3
million, such that the project has a negative expected NPV of
$1.61.6
million. Upon closer examination, you find that there is a
5555
percent chance that this new restaurant will be well received and will produce annual cash flows of
$805 comma 000805,000
per year forever (a perpetuity), while there is a
4545
percent chance of it producing a cash flow of only
$199 comma 000199,000
per year forever (a perpetuity) if it isn't received well. The required rate of return you use to discount the project cash flows is
10.110.1
percnet. However, if the new restaurant is successful, you will be able to build
1515
more of them and they will have costs and cash flows similar to the successful restaurant's costs and cash flows.
a. In spite of the fact that the first restaurant has a negative NPV, should you build it anyway? Why or why not?
b. What is the expected NPV for this project if only one restaurant is built but isn't well received? What is the expected NPV for this project assuming
1515
more are built if the first restaurant is well received? (Ignore the fact that there would be a time delay in building additional new restaurants.)
In: Accounting
Write a Python program that computes certain values such as sum, product, max, min and average of any 5 given numbers along with the following requirements.
Define a function that takes 5 numbers, calculates and returns the sum of the numbers.
Define a function that takes 5 numbers, calculates and returns the product of the numbers.
Define a function that takes 5 numbers, calculates and returns the average of the numbers. Must use the function you defined earlier to find the sum of the five numbers.
Define a function that takes 5 numbers, finds and returns the largest value among the numbers. Must use conditional statements and NOT use built-in max function.
Define a function that takes 5 numbers, finds and returns the smallest value among the numbers. Must use conditional statements and NOT use any built-in min function.
Define a function called main inside which Prompt users to enter 5 numbers. Call all the functions passing those 5 numbers entered by the user and display all the returned answers with proper descriptions.
Define a function called test For each of the functions you defined (6-10) write at least 2 automated test cases using assert statements to automatically test and verify that the functions are correctly implemented. make your program continue to run and calculate the same statistical values of as many sets of 5 numbers as a user wishes until they want to quit the program.
In: Computer Science
Pureform, Inc., uses the weighted-average method in its process costing system. It manufactures a product that passes through two departments. Data for a recent month for the first department follow:
| Units | Materials | Labor | Overhead | ||||
| Work in process inventory, beginning | 79,000 | $ | 99,000 | $ | 34,200 | $ | 46,700 |
| Units started in process | 749,000 | ||||||
| Units transferred out | 770,000 | ||||||
| Work in process inventory, ending | 58,000 | ||||||
| Cost added during the month | $ | 1,297,800 | $ | 523,355 | $ | 598,120 | |
The beginning work in process inventory was 80% complete with respect to materials and 65% complete with respect to labor and overhead. The ending work in process inventory was 60% complete with respect to materials and 50% complete with respect to labor and overhead.
Required:
Assume that the company uses the FIFO method in its process costing system.
1. Compute the first department's equivalent units of production for materials, labor, and overhead for the month.
2. Compute the first department's cost per equivalent unit for materials, labor, overhead, and in total for the month. (Round your answers to 2 decimal places.)
.
Madison Park Co-op, a whole foods grocery and gift shop, has provided the following data to be used in its service department cost allocations:
|
Service Departments |
Operating Departments |
||||||
| Administration | Janitorial | Groceries | Gifts | ||||
| Departmental costs before allocations | $200,000 | $60,000 | $3,820,000 | $340,000 | |||
| Employee-hours | 480 | 310 | 2,720 | 170 | |||
| Space occupied—square feet | 600 | 1,300 | 9,400 | 600 | |||
Required:
Using the step-down method, allocate the costs of the service departments to the two operating departments. Allocate Administration first on the basis of employee-hours and then Janitorial on the basis of space occupied. (Please enter allocations from a department as negative and allocations to a department as positive. The line should add across to zero. Do not round intermediate calculations. Round your answers to the nearest whole dollar amount.)
In: Accounting
Linda is a 60-year-old woman with moderate mental retardation who has recently been diagnosed with congestive heart failure. Her doctor has recommended that Linda lose weight, get regular exercise, and eat low sodium, low cholesterol diet. She lives in an adult living facility. Linda works at a local shelter. She is required to bring lunch to the shelter every day and she always brings a bologna and cheese sandwich, a bag of pretzels and a chocolate chip cookie. During her morning break, she always gets a Coke and a bag of potato chips from the vending machine for a snack. Linda has eaten this same diet every day for at least 25 years and is very resistant to the idea of changing what she eats for lunch every day. After work Linda has staff that supports her in cooking dinner and she has tried a variety of foods. On the weekends her favorite thing to do is to go to Burger King for a Whopper with cheese and a large French fries. Linda has support with going grocery shopping. She is willing to pick out a variety of foods, but she always insists on buying pretzels and potato chips. She becomes very angry when staff suggest that she leave the store without the two items. Linda had had no trouble taking medication as she has staff who remind her in the morning and at night that she needs to do this. She also has support with monitoring her weight every day. She must monitor her weight to assure that she is not retaining water. Linda does not get any regular exercise. She has trouble climbing the set of stairs to her second-floor apartment. A couple of weeks ago one of the staff that supports her tried taking her for an hour walk in a near-by park. She had to turn around after 15 minutes because she was exhausted, and declared that she would never go walking again. Linda is fascinated by machines. One of the staff on weekends noted that she watched several infomercials about treadmills, rowing machines, and other types of exercise equipment. What are the behaviors that need to be changed? What health promotion actions would help? What additional supports or information might motivate Linda? Do you believe Linda can follow her doctor's recommendations? Why or why not?
In: Psychology
physics

Questions
Do any equipotential lines cross one another?
Do any field lines cross one another?
Estimate the electric field strength at a point :
(a) half way between the terminals and
(b) near one of the terminals by using the relation: where AV is the potential difference between two points (for example, two points on successive equipotential lines) and AL is the distance measured along a field line.
Where is the field the strongest? Where is the field the weakest?
In: Physics
When a sound wave travels directly toward a hard wall, the incoming and reflected waves can combine to produce a standing wave. There is an antinode right at the wall, just as at the end of a closed tube, so the sound near the wall is loud. You are standing beside a brick wall listening to a 80Hz tone from a distant loudspeaker.
How far from the wall must you move to find the first quiet spot? Assume a sound speed of 340 m/s.
In: Physics
The US economy has shrunk 5% due to the impact of the Covid19 pandemic. President Trump has passed a piece of legislation that allows for 5 Trillion dollars to be put back into the economy, through near-zero interest loans for business, and payments of nearly $2,000 for the population. How do you think people will use their $2,000 payment, and why. How do you think industry will use their much larger payments, and why. Comment on short term, and long term application.
In: Economics
In: Economics
A “conventional gear” tailwheel airplane has the center of mass aft of the two main wheels and a smaller, third wheel at the tail. A “tricycle gear” airplane has the center of mass forward of the two main wheels and the third wheel near the nose. Consider a shiny, new airplane landing on its main wheels, with the fuselage at a left yaw angle with respect to the direction of motion down the runway. With which of these two types of landing gear would the airplane be easier to land? Explain.
In: Physics