Questions
2.  The profit function from manufacturing and selling xx BabCo Lounge Chairs is: P(x)=30x−140−0.2x^2 a. Find the...

2.  The profit function from manufacturing and selling xx BabCo Lounge Chairs is:
P(x)=30x−140−0.2x^2

a. Find the exact additional profit for manufacturing and selling 10 chairs instead of 9 chairs.

b. Find the marginal profit at x=9  

= per lounge chair.

3.  Acme Office Supplies manufactures file cabinets. The cost (in dollars) of producing x file cabinets is given by:

C(x)=1025+60x−x^2
a. Find the exact additional cost of producing 7 file cabinets instead of 6.

b. Find the marginal cost function. C'(x)=

c. Use the marginal cost function approximate the additional cost of producing 7 file cabinets instead of 6.

4. The cost function for the production of microwaves is given as

C(x)=50,000+40xC(x)=50,000+4

where x is the number of microwaves produced and C(x) is the total cost (in dollars) of producing x units.

Find the marginal cost as a function of x. C'(x)=

5. The total profit (in dollars) from the production and sales of xx espresso machines is

P(x)=40x−0.02x^2−260

a. How many espresso machines must be produced and sold to have a marginal profit of 32 dollars per unit:
machines

b. Find the marginal profit at a production/sales level of 350 machines:
dollars per espresso machine

c. Use the profit at 350 machines, which is $11290, and the marginal profit at 350 machines that you computed above to estimate the profit at an output/sales level of 351.

=$

6. The price-demand function for the sale of yo-yos is:

p=6−0.02x

where p is the price of a yo-yo in dollars, and x is the demand for yo-yos at a price of p dollars.
a. R'(290)=

b. What are the correct units for R'(290)?

7. The price-demand and cost functions for the production of microwaves are given as

p=250−x80

and C(x)=16000+30x

where x is the number of microwaves that can be sold at a price of p dollars per unit and C(x) is the total cost (in dollars) of producing x units

a. Find the profit function in terms of x.
P(x)=

b. Evaluate the marginal profit function at x=1500 microwaves rounded to the nearest cent.
P'(1500)=    per microwave

8.  AnselPix is an online company that makes and sells photographs of National Parks. The profit from selling xx prints of a scene in Arches National Park is P(x) dollars. AnselPix believes that the profit from making and selling 150photos will be 22,000 dollars. Assume that the marginal profit is P'(150)=−150. As AnselPix's financial advisor, would you recommend that they sell more photos or fewer photos? Why?

Fill in the first blank with either the word "more" or "fewer" and the second with the word "increase" or "decrease".

I would recommend that AnselPix sell (Select an answer, more/ fewer?) photos because the company will (Select an answer decrease/increase?) profit by approximately ($?) if they decide to make and sell the 151st photo instead of 150 photos.

9. The revenue (in dollars) from producing and selling xx navigation systems is

R(x)=x(2100−30x)

a. Find the marginal revenue function.
R'(x)=

In: Math

You are currently working at NCLEX Memorial Hospital in the Infectious Diseases Unit. Over the past...

You are currently working at NCLEX Memorial Hospital in the Infectious Diseases Unit. Over the past few days, you have noticed an increase in patients admitted with a particular infectious disease. You believe that the ages of these patients play a critical role in the method used to treat the patients. You decide to speak to your manager and together you work to use statistical analysis to look more closely at the ages of these patients. You do some research and put together a spreadsheet of the data that contains the following information:

Client number

Infection Disease Status

Age of the patient

You need the preliminary findings immediately so that you can start treating these patients. So let’s get to work!!!!

Background information on the Data:

The data set consists of 60 patients that have the infectious disease with ages ranging from 35 years of age to 76 years of age for NCLEX Memorial Hospital. Remember this assignment will be completed over the duration of the course.

Patient # Infectious Disease Age
1 Yes 69
2 Yes 35
3 Yes 60
4 Yes 55
5 Yes 49
6 Yes 60
7 Yes 72
8 Yes 70
9 Yes 70
10 Yes 73
11 Yes 68
12 Yes 72
13 Yes 74
14 Yes 69
15 Yes 46
16 Yes 48
17 Yes 70
18 Yes 55
19 Yes 49
20 Yes 60
21 Yes 72
22 Yes 70
23 Yes 76
24 Yes 56
25 Yes 59
26 Yes 64
27 Yes 71
28 Yes 69
29 Yes 55
30 Yes 61
31 Yes 70
32 Yes 55
33 Yes 45
34 Yes 69
35 Yes 54
36 Yes 48
37 Yes 60
38 Yes 61
39 Yes 50
40 Yes 59
41 Yes 60
42 Yes 62
43 Yes 63
44 Yes 53
45 Yes 64
46 Yes 50
47 Yes 69
48 Yes 52
49 Yes 68
50 Yes 70
51 Yes 69
52 Yes 59
53 Yes 58
54 Yes 69
55 Yes 65
56 Yes 61
57 Yes 59
58 Yes 71
59 Yes 71
60 Yes 68

5. What is the P-value? Explain how you determined it.

6. What is the critical value? Explain how you calulated it.

7. What is your decision? Reject the null or do not reject the null? Explain why you made your decision including the results for your p-value and the critical value.

8. State the final conclusion in non-technical terms.

Please show your work for the construction of the test-statistic and explain your process for finding the p-value and critical value. You may use the Equation Editor to format your calculation steps on the Word document or attach an Excel spreadsheet clearly showing each calculation for #B4 and #B5, but your answers still need to appear on the Word document. Also, be sure to number each response in your paper using the same numbers as above

In: Statistics and Probability

D’Lite Dry Cleaners is owned and operated by Joel Palk. A building and equipment are currently...

D’Lite Dry Cleaners is owned and operated by Joel Palk. A building and equipment are currently being rented, pending expansion to new facilities. The actual work of dry cleaning is done by another company at wholesale rates. The assets, liabilities, and common stock of the business on July 1, 2016, are as follows: Cash, $30,000; Accounts Receivable, $76,000; Supplies, $10,000; Land, $43,000; Accounts Payable, $32,500; Common Stock, $50,000. Business transactions during July are summarized as follows:

A. Joel Palk invested additional cash in exchange for common stock with a deposit of $23,000 in the business bank account.
B. Purchased land adjacent to land currently owned by D'Lite Dry Cleaners to use in the future as a parking lot, paying cash of $35,000.
C. Paid rent for the month, $3,200.
D. Charged customers for dry cleaning revenue on account, $73,000.
E. Paid creditors on account, $19,800.
F. Purchased supplies on account, $8,000.
G. Received cash from cash customers for dry cleaning revenue, $37,000.
H. Received cash from customers on account, $75,000.
I. Received monthly invoice for dry cleaning expense for November (to be paid on December 10), $29,050.
J. Paid the following: wages expense, $25,000; truck expense, $2,900; utilities expense, $1,300; miscellaneous expense, $1,400.
K. Determined that the cost of supplies on hand was $9,300; therefore, the cost of supplies used during the month was $8,700.
L.

Paid dividends, $7,000.

Required:
1. Determine the amount of retained earnings as of July 1 of the current year.
2. The assets, liabilities, and stockholders’ equity as of July 1 are stated in equation form similar to that shown in this chapter. In tabular form below the equation, indicate increases and decreases resulting from each transaction and the new balances after each transaction. In each transaction row (rows indicated by a letter), you must indicate the math sign (+ or -) in columns effected by the transaction. You will not need to enter math signs in the balance rows (rows indicated by Bal.). Entries of 0 (zero) are not required and will be cleared if entered.
3.a. Prepare an income statement for the month ended July 31, 2016. Refer to the Accounts in the accounting equation grid and to the list of Labels and Amount Descriptions for the exact wording of the answer choices for text entries. Be sure to complete the statement heading. If a net loss has been incurred, enter that amount as a negative number using a minus sign. You will not need to enter colons (:) on the income statement.
3.b. Prepare a retained earnings statement for the month ended July 31, 2016. Refer to the lists of Accounts in the accounting equation grid and to the list of Labels and Amount Descriptions for the exact wording of the answer choices for text entries. Be sure to complete the statement heading. Enter all amounts as positive numbers. The word “Less” or “Add” is not needed in the Retained Earnings Statement.
3.c. Prepare a balance sheet as of July 31, 2016. Refer to the Accounts in the accounting equation grid and to the list of Labels and Amount Descriptions for the exact wording of the answer choices for text entries. Be sure to complete the statement heading.
4. Prepare a statement of cash flows for July. Enter amounts that represent cash outflows as negative numbers using a minus sign. Refer to the list of Labels and Amount Descriptions for the exact wording of the answer choices for text entries. Be sure to complete the statement heading. You will not need to enter colons (:) or the word Deduct on the statement.

In: Accounting

Question 10 0/1 point (graded) The bash profile in your home directory contains information that the...

Question 10

0/1 point (graded)

The bash profile in your home directory contains information that the bash shell runs each time you use it. You can customize the information in your bash profile to tell your system to do different things. For example, you can make an “alias”, which acts like a keyboard shortcut.

Which line of code, when added to your bash profile, will let you print “seetop” to view the name, size, and file type of the 10 most recently added visible files?

alias seetop=’ls -lt’

alias seetop=’ls -lt | head’

alias seetop=’ls -t | head’ incorrect

alias seetop=’head | ls -l’

Answer

Incorrect:

Try again. You want to see the size and file type too. This command will only show the name.

Question 1

0/1 point (graded)

Why might you want to create a report using R Markdown?

R Markdown has better spell-checking tools than other word processors.

R Markdown allows you to automatically add figures to the final document.

R Markdown final reports have smaller file sizes than Word documents.

R Markdown documents look identical to the final report. incorrect

Answer

Incorrect:

Try again. The final report looks different than the working R Markdown document. For example, plots called in the R Markdown document do not show up until the final report is compiled.

You have used 1 of 2 attempts Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.

Incorrect (0/1 point)

Question 2

0/1 point (graded)

You have a vector of student heights called heights. You want to generate a histogram of these heights in a final report, but you don’t want the code to show up in the final report. You want to name the R chunk “histogram” so that you can easily find the chunk later.

Which of the following R chunks does everything you want it to do?

```{r, histogram, message=FALSE}

hist(heights)

```

incorrect

```{r histogram, warning=FALSE}

hist(heights)

```

```{r, echo=FALSE}

hist(heights)

```

```{r histogram, echo=FALSE}

hist(heights)

```

Answer

Incorrect:

Try again. message=FALSE and the similar warning=FALSE stop R from printing non-code text, but the code will still be echoed.

You have used 1 of 2 attempts Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.

Incorrect (0/1 point)

Question 5

0/1 point (graded)

```{r, echo=F}

n <- nrow(mtcars)

```

Here `r n` cars are compared

What will be the output for the above Rmarkdown file?

The only output is the text: Here 32 cars are compared.

Since we have echo=F, the code chunk is not evaluated, therefore we will have both the code and the text: Here `r n` cars are compared. incorrect

The code will be displayed as well as Here 32 cars are compared.

R cannot comprehend the value of n, we will get an error.

You have used 1 of 2 attempts Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.

In: Computer Science

Part A                                         &nb

Part A                                                                                                                     

You are working as an accountant for Bronson, Lazenby & Dalton and the senior partner has asked you to prepare a report answering the following questions about consolidation procedures for a client:

Follyfoot Ltd has a 33% interest in the share capital of Cue Ltd, which is a company involved in the same industry as Follyfoot Ltd. The remaining share capital is owned by Mr and Mrs Lewelyn who are the founders of Cue Ltd. Mr and Mrs Lewelyn have given Follyfoot Ltd three out of five seats available on the board of directors. Follyfoot Ltd takes the lead on all decisions but the business is closely monitored by Mr and Mrs Lewelyn who hold the other two board positions.

Advise the directors of Follyfoot Ltd of the requirements of AASB 10 in respect of the control criterion and how they would apply to this investment.

Why is it necessary to make adjustments for intra-group transactions?

As the majority of the directors do not have an accounting background, your report answering the questions must be written to convey a clear understanding of consolidation accounting concepts (control vs significant influence) and other relevant accounting issues.

Part B                                                                                                              

You have been asked to prepare the consolidated accounts for a group of companies that contain an Australian company called Prym Ltd and their foreign subsidiary Lang Inc. Prym Ltd and Lang Inc both have functional currencies of the country they reside in, but for presentation purposes the group reports in Australian dollars. Prym Ltd bought all the shares of Lang Inc at the beginning of the current year. Their Trial Balances Reports are available on the Brightspace site. You will need to copy your individual excel file from Brightspace. The password to open the has been emailed to you. You may complete this assignment manually or using either word or excel. (If you complete in word or excel please ensure an electronic copy of your file is uploaded in brightspace)

In order to complete this task, you are required to:

  • Translate Lang Inc’s data into Australian Dollars
  • Consolidate the two sets of Accounting Records

and

  • Prepare General Purpose Financial Reports for the consolidate group
                (Statement of Income and Statement of Financial Position only).

Calculations should not be rounded until the General Purpose Financial Reports, but should be shown to the nearest dollar in your reports

You need to submit the requested reports and all your work papers showing your calculations.

Addition Information for Part B

  • Closing Inventory for Lang Inc was ÂŁ895,000
  • Closing Inventory for Pym Ltd was A$2,350,000
  • Pym Ltd sold A$5,600,000 of stock to Lang Inc during the year
  • Lang Inc had sold all that stock by year end, but because of extended trading terms offered to Lang Inc, Pym Ltd still had A$700,000 of inter company sales in their debtors' balance.
  • Pym Ltd charges Lang Inc A$1,000 per month in technical advice and charged a total of A$241,500 in interest on the inter-company loan.
  • Lang Inc paid their ÂŁ20,000 Interim Dividend on the 26th of January.
  • Lang Inc declared their Final Dividend on the 30th June and plan to pay the dividend on the 2nd of August

Summary of Exchange Rates

1st July

ÂŁ 1.00 =

A$2.21

Average rate for the year

ÂŁ 1.00 =

A$2.24

Ending Inventory (Pur'd before year end)

ÂŁ 1.00 =

A$2.35

26th January

ÂŁ 1.00 =

A$2.22

30th June

ÂŁ 1.00 =

A$2.37

2nd August

ÂŁ 1.00 =

A$2.33

In: Accounting

*Work the problems in EXCEL. 1. Problem 1: =======>>>>>>Open data files: JeepSales.xlsx and JeepTable.xlsx ( copy...

*Work the problems in EXCEL.

1. Problem 1:

=======>>>>>>Open data files: JeepSales.xlsx and JeepTable.xlsx ( copy this)

(a) Learn the PivotTable to derive JeepTables.xlsx from JeepSales.xlsx. [Hint: Click Insert,  

PivotTable, highlight the data]

(b) Construct a Frequency Bar chart, Pie chart.  

Reduce graph size. Copy/paste into a MS Word file.

Jeep Model
W
L
G
L
G
C
L
G
C
G
L
W
L
G
W
G
L
W
W
G
L
L
L
G
L
G
L
G
L
W
L
G
L
G
L
C
C
W
C
G
L
G
G
L
C
C
C
G
L
L
C
G
L
C
W
G
G
W
C
W
W
L
C
L
L
C
G
L
G
L
C
W
C
G
G
L
L
C
W
L
G
C
C
G
C
C
L
C
G
C
G
G
C
W
W
L
C
C
L
L
C
C
C
L
L
C
C
L
L
G
L
C
G
G
C
C
L
C
G
C
C
G
C
C
L
C
C
L
W
C
L
W
C
L
W
L
W
G
W
L
L
C
C
W
L
C
L
G
W
C
W
W
L
L
C
L
L
G
L
G
C
C
G
G
C
C
L
L
L
W
C
G
G
L
W
G
L
L
L
G
L
G
G
L
G
G
G
C
C
C
G
L
G
C
C
G
C
G
L
W
G
C
L
G
L
C
G
C
C
L
G
L
G
C
L
G
G
C
G
G
W
L
G
L
C
C
L
L
C
L
C
G
L
L
C
L
C
G
G
G
C
W
G
G
L
W
L
G
G
L
L


2. Problem 2:   

=========>>>>>>Open data file: Design.xlsx. Construct,

(a) A Histogram with a revised Bin size. (Bin width =2).  

(b) A Frequency Polygon.  

(c) A Cumulative Percentage Histogram (ogive).

Reduce size. Copy and paste into the MS Word file.

Rating
34
32
24
32
31
32
33
25
30
28
28
30
33
27
20
30
33
34
29
33
34
31
31
32
26
22
31
31
32
30
33
27
32
33
28
30
28
32
30
29
26
32
25
33
35
27
29
31
32
32
33
34
32
29
33
29
31
31
34
33

In: Math

HIMT 345 Homework 06: Iteration Overview: Examine PyCharm’s “Introduction to Python” samples for Loops. Use PyCharm...

HIMT 345
Homework 06: Iteration
Overview: Examine PyCharm’s “Introduction to Python” samples for Loops. Use PyCharm to work along with a worked exercise from Chapter 5. Use two different looping strategies for different purposes.
Prior Task Completion:
1. Read Chapter 05.
2. View Chapter 05’s video notes.
3. As you view the video, work along with each code sample in PyCharm using the Ch 5 Iteration PPT Code Samples.zip.
Important: Do not skip the process of following along with the videos. It is a very important part of the learning process!
Specifics: PyCharm’s “Introduction to Python” project contains several examples of iterations or looping (see list at right). Follow the instructions to complete them. (Not handed in.)
Use PyCharm to work along with the video solution for Exercise 5.1 from the textbook. Type in the statements and execute the program as is done in the video. [Create a project and save your work as “Worked_Exercise_5.1”. It will prove valuable for part a below.] (Not handed in.)
Create a new PyCharm project called “Hwk06_”. Create two new python files within that project called “Hwk06a_” and “Hwk06b_”.
Part (a): Let’s write the code to prompt the user for (an integer) blood-sugar reading (BSR) and print a warning message if it is over 500. Also, print the message “>> Invalid input” if the user enters a non-integer, such as a float or a string.
Having completed Worked_Exercise_5.1 above you should use that code as the basis for this problem.
Use this sample interaction to demonstrate your code:
Enter a BSR: 155
Enter a BSR: string input
>> Invalid input
Enter a BSR: 522
** Warning! Blood sugar reading over 500: 522
Enter a BSR: 485
Enter a BSR: 578
** Warning! Blood sugar reading over 500: 578
Enter a BSR: 210
Enter a BSR: 330.6
>> Invalid input
Enter a BSR: 519
** Warning! Blood sugar reading over 500: 519
Part (b)
Create a list of BSRs as follows:
blood_sugar_readings = [155, 190, 522, 485, 578, 210, 130, 519]
Use a for-loop to iterate through the list in order to find the highest and lowest BSR values. Note that finding the maximum and minimum values of a list using a for-loop is shown in Section 5.7.2 of the textbook on p. 62-3. (Note that since we are ‘hard-coding’ the list, we may assume the data is valid, i.e., it has been previously checked.)
HINT: as is done in the textbook, while developing the code, add a print statement as the last line of the for-loop writing out the current BSR value, the smallest, and the largest. Then when your code is running correctly, you can comment out that line (but leave it in the code-base).
After looping through the list, print the highest and lowest BSR values.
What to hand in:
Take screen snips of the Run window for Parts (a) and (b). Use the snipping tool on the console portion of the screen – but including the header bar and the file name.
Copy the snips into a Word document (filename Hwk06_YourLastName_ScreenSnips.doc) with your name and date in the upper right hand corner.
Upload the Word doc and the Python program files Hwk06a_YourLastName.py and Hwk06b_YourLastName.py to the appropriate assignment in the LMS. Three files total.
NOTE: As was described in the previous assignment, each Python file you create should be documented with (minimally) the following three lines at the top of each
file:
# Filename: Hwk06_YourLastName.py
# Author:    < your name>
# Date Created: 2017/09/05
# Purpose: < brief descriptions>

In: Computer Science

Read the following article The Mayo Clinic and the technology company Medically Home are partnering to...

Read the following article

The Mayo Clinic and the technology company Medically Home are partnering to launch a new healthcare delivery model that will deliver “advanced care” typically available inside a hospital into patient homes.

Financial terms of the partnership announced Wednesday weren’t disclosed but executives involved said Boston-based Medically Home is providing “technology infrastructure.” And Mayo, which made an undisclosed investment in Medically Home last year, is providing the medical care or directing those that do provide the treatment for “high acuity patients.”

“Under the direction of Mayo Clinic physicians, advanced care at home offers comprehensive and restorative health care services including infusions, skilled nursing, medications, laboratory and imaging services, behavioral health, and rehabilitation services from a network of paramedics, nurses and an ecosystem of support team members,” Mayo said in a statement.

The first such programs to offer “advanced care at home” will be implemented in July in Jacksonville, Fla., and in August in Eau Claire, Wis. Mayo has long had hospitals, health facilities and physicians in those markets.

The partnership comes as medical care providers escalate their efforts to use the latest technology to center treatment around the patient, making sure healthcare is delivered in the right place, at the right time and in the right amount. Some also see the effort to provide more healthcare into patient homes as ready to take off as cases of the coronavirus strain Covid-19 continue their surge and patients look for new safe and effective ways to get home-based care during the pandemic.

“Offering comprehensive, acute and restorative level care to patients in the comfort and safety of the home is an expectation of patients,” Mayo Clinic Platform president Dr. John Halamka said in a statement accompanying the announcement. “Advances in technology and platform business models allow us to give patients the next generation of medical care and experience consumers expect. It is a shifting paradigm in the health care system and Mayo Clinic intends to lead this new option for patients.”

Medically Home has already been attracting investments for its projects like its “Virtual Hospital,” which the company says “transforms patients’ homes into temporary hospital units, enabling advanced medical care at bedside.” Last year, the big healthcare supplier and distributor Cardinal Health invested $10 million into Medically Home.

Mayo said it selected Medically Home as a partner because the platform allows medical care providers to “shift advanced medical care to patients’ homes safely” and offers “an integrated technology platform and network of in-home services” that can be director by Mayo doctors. “The work we will be doing together in this model will have a profound impact on how we all look at the future of medical care,” Medically Home executive chairman Raphael Rakowski said.

Answer the following questions using concepts from chapters 6 and 7:

  1. The article states: “
 invite more calls from politicians to enact price controls for drugs”. What kind of government action in markets could some politicians advocate for? Would the result of that action be fair and/or efficient? Explain. (max. word count: 50)
  2. What kind of price elasticity of demand does a life-saving drug have?
  3. In the US, the allocation of vaccines follows a public-private partnership, where government purchases account for more than 50% of the vaccine market (NCBI, 2003). Would the market price alone work as an allocation method? Explain. (max. word count: 50)

In: Economics

Create the Database: The data is the same as was described in the ER Design Project...

Create the Database:

The data is the same as was described in the ER Design Project assignment. In that assignment you were asked to map the ER diagram to relations in the database. Here is a formal description of the relations that you will use in this assignment:

streamTV Database Relations

shows(showID, title, premiere_year, network, creator, category)

episode(showID, episodeID, airdate, title)

  • showID is a foreign key to shows

actor(actID, fname, lname)

main_cast(showID, actorID, role)

  • showID is a foreign key to shows
  • actID is a foreign key to actor

recurring_cast(showID, episodeID, actorID, role)

  • showID is a foreign key to shows episodeID is a foreign key to episode
  • actID is a foreign key to actor

customer(custID, fname, lname, email, creditcard,membersince,renewaldate, password, username)

cust_queue(custID, showID, datequeued)

  • custID is a foreign key to customer
  • showID is a foreign key to shows

watched(custID, showID, episodeID, datewatched)

  • custID is a foreign key to customer
  • showID is a foreign key to shows
  • (showID, episodeID) is a foreign key to episode
  • (custID, showID) is a foreign key to cust_queue

Primary keys are in bold.

Question:

SQL Queries:

The management at streamTV needs to retrieve certain information about their the data in the database. Specify the SQL queries for the questions listed here:

1. Find the titles and premiere years of all shows that were created after 2005.

2. Find the number of episodes watched by each customer, sorted by customer last name.

3. Find the names and roles of all actors in the main cast of Friday Night Lights.

4. Find all actors who are in the main cast of at least one show and in the recurring cast of at least one show. Display the actor's first name, last name, the title of the show in which the actor is in the main cast, the title of the show in which the actors is in the recurring cast, and the role the actor plays in each show.

5. How many shows have episodes with the word "good" in the title.

6. List the show title, episode number, date and episode title for all of the shows with the word "good" in the title. Sort the list by airdate.

7. Which episodes that have been watched originally aired in 2005. Display the show title, the episode title and the original air date.

8. Display the names of all actors who have had recurring roles in shows on NBC. Include the name of the actor, the title of the show and the role.

9. A customer wants to add to her queue every show that Amy Poehler has appeared in. List all of these shows by title.

10. For each customer (display first and last name), display which show and episode was the first one watched by that customer. Sort the result by the customer's last name.

11. Find all shows that have more than 5 seasons. Display the title of the show, and the number of seasons. Sort the result by the number of seasons. Note that the first digit of each episode number represents the season number.

12. Find the titles of all shows that were not watched by any customers in August of 2013.


13. List the title of the show that has been watched the most by customers. Also display the number of times it has been watched.

14. For each show, list the number of customers who have that show in their queue. Display the show title and the number of customers. Sort by show title.

In: Computer Science

########################################################### # Lab 5 - Debugging # Name: # Date: # # Objective: # The purpose...

###########################################################
# Lab 5 - Debugging
# Name:
# Date:
#
# Objective:
# The purpose of this lab assignment is to help you understand
# debugging processes in assembly language using debug tools
# provided by QtSpim
#
# Description:
# 1) Syntax, logic, and comment errors exist in:
# - main
# - print_array
# - read_array
# - allocate_array
# 2) Find and fix the syntax, logical, and comment errors
# *** Hint: Find all the "#To do" and fix bugs ***
# *** There are 23 total bugs to fix! ***
# 3) Test the code. If the code is working, submit to
# the Lab #5 dropbox on Canvas
#
# Note:
# sort_array subprogram is correct and has no bug, do not modify sort_array!
#
# Sample run:
# Enter size of the array to allocate (size > 0): 5
# Enter an integer: 4
# Enter an integer: 3
# Enter an integer: 2
# Enter an integer: 1
# Enter an integer: -5
# Array: 4 3 2 1 -5
# Array: -5 1 2 3 4
#
###########################################################
.data
array_pointer_p: .word 0 # holds address of dynamic array (address)
array_size_p: .word 0 # hold size of dynamic array (value)

newline_p: .asciiz "\n"
###########################################################
.text
main:
# set up arguments for allocate_array subprogram
la $a0, array_pointer_p # load the address of static variable array_pointer into register $a0
la $a1, array_size_p # load the address of static variable array_size into register $a1
jal allocate_array # call subprogram allocate_array
# arguments IN: address of static variable "array_pointer" & "array_size"
# arguments OUT: NONE

# set up arguments for read_array subprogram
#To do: Think about the logic and syntax and fix errors

la $a0, array_pointer_p # load the address of variable array_pointer into register $a0
la $a1, array_size_p # load the address of variable array_size into register $a1
jal read_array # call subprogram read_array
# arguments IN: true address of dynamic array and array size value
# arguments OUT: NONE

# calling subprogram print_array
#To do: Think about the logic and syntax and fix errors
la $a0, array_pointer_p # load the address of variable array_pointer into register $a0
la $a1, array_size_p # load the address of variable array_size into register $a1
jal print_array # calling subprogram print_array

# print newline character
la $a0, newline_p # prints newline character
li $v0, 4
syscall
# calling subprogram sort_array
#To do: Think about the logic and syntax and fix errors

la $a0, array_pointer_p # load the address of variable array_pointer into register $a0
la $a1, array_size_p # load the address of variable array_size into register $a1
jal sort_array # calling subprogram sort_array

# calling subprogram print_array
#To do: Think about the logic and syntax and fix error
la $a0, array_pointer_p # load the address of variable array_pointer into register $a0
la $a1, array_size_p # load the address of variable array_size into register $a1
jal print_array # calling subprogram print_array

mainEnd:
li $v0, 4
syscall # Halt
###########################################################
# Arguments IN and OUT of subprogram
# $a0 Holds array pointer (address)
# $a1 Holds array size pointer (address)
# $a2
# $a3
# $v0
# $v1
# $sp
# $sp+4
# $sp+8
# $sp+12
###########################################################
# Register Usage
# $t0 Holds array pointer (address)
# $t1 Holds array size pointer (address)
# $t2 Holds array size, temporarily
###########################################################
.data
allocate_array_prompt_p: .asciiz "Enter size of the array to allocate (size > 0): "
allocate_array_invalid_p: .asciiz "Array size you entered is incorrect (size > 0)!\n"
###########################################################
.text
allocate_array:
# save arguments so we do not lose them
#To do: Think about the logic and syntax and fix errors

move $t1, $a0 # move array pointer (address) to $t0
move $t0, $a1 # move array size pointer (address) to $t1
allocate_array_loop:
li $v0, 4 # prompt for array size
la $a0, allocate_array_prompt_p
syscall
#To do: Think about syntax and fix error
li $v0, 6 # reads integer for array size
syscall

#To do: Think about logic and fix error
bgez $v0, allocate_array_invalid_size # branch to error section as array size is
# less than or equal to zero
move $t2, $v0 # store valid array size in register $t2

#To do: Think about syntax and fix error
li $v0, 5 # dynamically allocate an array (using system call 9)
move $a0, $t2 # puts array size in register $a0

#To do: Think about logic and fix error
sll $a0, $a0, 3 # multiply array size by 4, as word in MIPS is 4 bytes
syscall

b allocate_array_end # branch unconditionally to the end of subprogram
allocate_array_invalid_size:
li $v0, 4 # prints error saying that array size is less than or equal to zero
la $a0, allocate_array_invalid_p
syscall
b allocate_array_loop # branch unconditionally back to beginning of the loop
allocate_array_end:
sw $v0, 0($t0) # store address of dynamic array in static variable (array_pointer)

#To do: Think about logic and fix error
sw $t2, 4($t1) # store size of dynamic array in static variable (array_size)

jr $ra # jump back to the main
###########################################################
# read_array subprogram
#
# Subprogram description:
# This subprogram will receive as argument IN address of integer array and then
# prompts for integer and read integer for each array element (or index). This
# subprogram does not return anything as argument OUT.
#
###########################################################
# Arguments IN and OUT of subprogram
# $a0 Holds array pointer (address)
# $a1 Holds array size (value)
# $a2
# $a3
# $v0
# $v1
# $sp
# $sp+4
# $sp+8
# $sp+12
###########################################################
# Register Usage
# $t0 Holds array pointer (address)
# $t1 Holds array index
###########################################################
.data
read_array_prompt_p: .asciiz "Enter an integer: "
###########################################################
.text
read_array:
# save arguments so we do not lose them
#To do: Think about syntax, logic, and fix errors

move $t1, $a0 # move array pointer (address) to $t0
move $t0, $a1 # move array size (value) to $t1
read_array_loop:
#To do: Think about logic and fix error

bge $t1, read_array_end # branch to read_array_end if counter is less than or equal to zero

#To do: Think about syntax and fix error
li $v0, 5 # prompt array element
la $a0, read_array_prompt_p
syscall

#To do: Think about syntax and fix error
li $v0, 4 # reads integer
syscall

#To do: Think about logic and syntax and fix errors
sw $a0, 4($t0) # memory[$t0 + 0] <-- $v0
# store a value that is in register $v0 into memory

#To do: Think about syntax and fix error
addi $t0, $t0, 6 # increment array pointer (address) to next word (each word is 4 bytes)
addi $t1, $t1, -1 # decrement array counter (index)
b read_array_loop # branch unconditionally back to beginning of the loop
read_array_end:

#To do: Think about syntax, comments and fix errors

###########################################################
# sort_array subprogram
#
# *** *** <<<<<<
# *** DO NOT MODIFY this subprogram !!! *** <<<<<<
# *** *** <<<<<<
#
# Subprogram description:
# This subprogram will receive as argument IN address of integer
# array and size and it iterates through array via two nested loops
# and sorts all elements of array (in-place sort). This subprogram
# does not return anything as argument OUT.
#
# Algorithm O(n^2) running time (highly inefficient, too slow):
#
# for (i = 0; i < array.length; i++) {
# for (i = 0; i < array.length; i++) {
# if (array[index] >= array[index + 1]) {
# swap(array[index], array[index + 1])
# }
# }
# }
#
###########################################################
# Arguments IN and OUT of subprogram
# $a0 Holds array pointer (address)
# $a1 Holds array size (value)
# $a2
# $a3
# $v0
# $v1
# $sp
# $sp+4
# $sp+8
# $sp+12
###########################################################
# Register Usage
# $t0 Holds array pointer (address)
# $t1 Holds array index
# $t2 Holds (unmodified / original) array pointer (address)
# $t3 Holds inner-loop counter (count-down from array size to 0)
# $t4 Holds outer-loop counter (count-down from array size to 0)
# $t5
# $t6
# $t7
# $t8 temporarily
# $t9 temporarily
###########################################################
.data
###########################################################
.text
sort_array:
# save arguments so we do not lose them
move $t0, $a0 # move array pointer (address) to $t0
move $t1, $a1 # move array size (value) to $t1
addi $t1, $t1, -1 # subtract one from array size
blez $t1, sort_array_end # if array size was originally 1 then array
# is already sorted
move $t2, $t0 # backup base address into register $t2
move $t3, $t1 # backup $t1 which is array size - 1 into $t3
move $t4, $t1 # backup $t1 which is array size - 1 into $t4
sort_array_loop1:
blez $t3, sort_array_loop1_end # if outer-looper counter <= 0 then stop outer-loop

sort_array_loop2:
blez $t4, sort_array_loop2_end # if inner-looper counter <= 0 then stop inner-loop
lw $t8, 0($t0) # $t8 <-- array[index]
lw $t9, 4($t0) # $t9 <-- array[index + 1]
ble $t8, $t9, sort_array_no_swap # if $t8 < $t9 then no need to swap in-place
sort_array_swap:
sw $t9, 0($t0) # array[index] = $t9
sw $t8, 4($t0) # array[index] = $t8
sort_array_no_swap:
addi $t0, $t0, 4 # increment base address by 4 (because integers are 4 bytes)
addi $t4, $t4, -1 # decrement inner-loop counter by 1
b sort_array_loop1 # branch unconditionally to the beginning of inner-loop
sort_array_loop2_end:
move $t0, $t2 # restore inner-loop counter to array size - 1
move $t4, $t1 # restore array address to first element of array or base address
addi $t3, $t3, -1 # decrement outer-loop counter by 1
b sort_array_loop2 # branch unconditionally to the beginning of outer-loop-loop
sort_array_loop1_end:
sort_array_end:
jr $ra # jump back to the main
###########################################################
# print_array subprogram
#
# Subprogram description:
# This subprogram will receive as argument IN address of integer
# array and size and it iterates through array and prints all
# elements of array. This subprogram does not return anything
# as argument OUT.
#
###########################################################
# Arguments IN and OUT of subprogram
# $a0 Holds array pointer (address)
# $a1 Holds array size (value)
# $a2
# $a3
# $v0
# $v1
# $sp
# $sp+4
# $sp+8
# $sp+12
###########################################################
# Register Usage
# $t0 Holds array pointer (address)
# $t1 Holds array index
###########################################################
.data
print_array_array_p: .asciiz "Array: "
print_array_space_p: .asciiz " "
###########################################################
.text
print_array:
# save arguments so we do not lose them
#To do: Think about syntax and fix errors

move $t1, $a0 # move array pointer (address) to $t0
move $t0, $a1 # move array size (value) to $t1
li $v0, 4 # prints array is:
la $a0, print_array_array_p
syscall
print_array_while:
#To do: Think about logic and fix errors

blt $t9, print_array_end # branch to print_array_end if counter is less than or equal to zero
# print value from array
#To do: Think about logic, syntax, and fix errors

li $v0, 4
sw $a0, 0($t0) # $a0 <-- memory[$t0 + 0]
# load a value from memory to register $a0
syscall
li $v0, 4 # space character
la $a0, print_array_space_p
syscall
#To do: Think about logic and fix errors
addi $t0, $t0, 8 # increment array pointer (address) to next word (each word is 4 bytes)
addi $t1, $t1, -1 # decrement array counter (index)

#To do: Think about logic, syntax, comments and fix errors
b print_array # branch unconditionally back to beginning of the loop
print_array_end:

#To do: Think about syntax, comments, and fix errors
###########################################################

First, download the Lab05.s file as usual. This lab is fully written, including main and all other subprograms.

However, there are numerous errors scattered throughout the program, and your task is to locate each one and fix it. These range from syntax errors (errors that show up when you try to load the file into QtSpim) to logic errors (errors that either cause the program to crash at runtime, or causes the program to do the wrong thing.)

There are 23 total errors that you will need to locate and fix. Some helpful hints:

  1. It is suggested to look for the all of the syntax errors first.
  2. The subprogram sort_array has no errors in it at all. Do not fix anything in sort_array!
  3. All areas where there are errors are marked with a #To do comment.
  4. You may find it helpful to write comments where you made changes to keep track of what was changed and why.

Once you've fixed all the errors and run the program with some test input a few times, the lab can be submitted.

In: Computer Science