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 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
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:
and
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 |
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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 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 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 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:
In: Economics
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)
actID is a foreign key to actor
recurring_cast(showID, episodeID, actorID, role)
actID is a foreign key to actor
customer(custID, fname, lname, email, creditcard,membersince,renewaldate, password, username)
cust_queue(custID, showID, datequeued)
showID is a foreign key to shows
watched(custID, showID, episodeID, datewatched)
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
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:
sort_array has no errors in it at all. Do not fix anything
in
sort_array!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
The project is adapted from the Chapter 4 Case Study dealing with NorthâSouth Airline In January 2012, Northern Airlines merged with Southeast Airlines to create the fourth largest U.S. carrier. The new NorthâSouth Airline inherited both an aging fleet of Boeing 727-300 aircraft and Stephen Ruth. Stephen was a tough former Secretary of the Navy who stepped in as new president and chairman of the board.
Stephenâs first concern in creating a financially solid company was maintenance costs. It was commonly surmised in the airline industry that maintenance costs rise with the age of the aircraft. He quickly noticed that historically there had been a significant difference in the reported B727-300 maintenance costs (from ATA Form 41s) in both the airframe and the engine areas between Northern Airlines and Southeast Airlines, with Southeast having the newer fleet.
On February 12, 2012, Peg Jones, vice president for operations and maintenance, was called into Stephenâs office and asked to study the issue. Specifically, Stephen wanted to know whether the average fleet age was correlated to direct airframe maintenance costs and whether there was a relationship between average fleet age and direct engine maintenance costs. Peg was to report back by February 26 with the answer, along with quantitative and graphical descriptions of the relationship.
Pegâs first step was to have her staff construct the average age of the Northern and Southeast B727-300 fleets, by quarter, since the introduction of that aircraft to service by each airline in late 1993 and early 1994. The average age of each fleet was calculated by first multiplying the total number of calendar days each aircraft had been in service at the pertinent point in time by the average daily utilization of the respective fleet to determine the total fleet hours flown. The total fleet hours flown was then divided by the number of aircraft in service at that time, giving the age of the âaverageâ aircraft in the fleet.
The average utilization was found by taking the actual total fleet hours flown on September 30, 2011, from Northern and Southeast data, and dividing by the total days in service for all aircraft at that time. The average utilization for Southeast was 8.3 hours per day, and the average utilization for Northern was 8.7 hours per day. Because the available cost data were calculated for each yearly period ending at the end of the first quarter, average fleet age was calculated at the same points in time. The fleet data are shown in the following table.
The project is derived from a case study located at the end of chapter 4 dealing with regression analysis. Please note, however that some of the numbers in the project tables in the text have been changed so students should get their complete instructions from the Project area provided in Getting Started section of the Table of Contents. Students should use the Data Analysis add-on pack from the standard Microsoft Excel software available in every Microsoft Office software since 2007. The project requirements are:
Submit your Excel Worksheet with five tabs (data, plus 4 tabs for the regressions) to the assignment drop box. Also include your formal response in a Microsoft Word document. Late work will not be accepted. The Excel worksheet and Word documents must be submitted BEFORE then end of Unit 7. This project is worth 160 points.
Note: Dates and names of airlines and individuals have been changed in this case to maintain confidentiality. The data and issues described here are real.
Northern Airline Data (numbers have been changed from text)
|
Airframe Cost |
Engine Cost |
Average Age |
|
|
Year |
per Aircraft |
per Aircraft |
(Hours) |
|
2001 |
61.80 |
33.49 |
6,512 |
|
2002 |
54.92 |
38.58 |
8,404 |
|
2003 |
69.70 |
51.48 |
11,077 |
|
2004 |
68.90 |
58.72 |
11,717 |
|
2005 |
63.72 |
45.47 |
13,275 |
|
2006 |
84.73 |
50.26 |
15,215 |
|
2007 |
78.74 |
80.60 |
18,390 |
Southeast Airline Data (numbers have been changed from text)
|
Airframe Cost |
Engine Cost |
Average Age |
|
|
Year |
Per Aircraft |
per Aircraft |
(Hours) |
|
2001 |
14.29 |
19.86 |
5,107 |
|
2002 |
25.15 |
31.55 |
8,145 |
|
2003 |
32.18 |
40.43 |
7,360 |
|
2004 |
31.78 |
22.10 |
5,773 |
|
2005 |
25.34 |
19.69 |
7,150 |
|
2006 |
32.78 |
32.58 |
9,364 |
|
2007 |
35.56 |
37.07 |
8,259 |
In: Statistics and Probability
C++ Question:
we need to read speech from .txt file.
Steve Jobs delivered a touching and inspiring speech at Stanford's 2005 commencement. The transcript of this speech is attached at the end of this homework description. In this homework, you are going to write a program to find out all the unique tokens (or words) used in this speech and their corresponding frequencies, where the frequency of a word w is the total number of times that w appears in the speech. You are required to store such frequency information into a vector and then sort these tokens according to frequency. Please feel free to use existing functions such as strtok() or sstream to identify tokens in this implementation.
Specifically, you are required to include the following elements in your program:
Declare a struct TokenFreq that consists of two data members: (1) string value; and (2) int freq; Obviously, an object of this struct will be used to store a specific token and its frequency. For example, the following object word stores the token "dream" and its frequency 100:
TokenFreq word;
word.value="dream";
word.freq=100;
Remember to declare this struct at the beginning of your program and outside any function. A good place would be right after the "using namespace std;" line. This way, all the functions in your program will be able to use this struct to declare variables.
Implement the function vector<TokenFreq> getTokenFreq( string inFile_name); This function reads the specified input file line by line, identifies all the unique tokens in the file and the frequency of each token. It stores all the identified (token, freq) pairs in a vector and returns this vector to the calling function. Don't forget to close the file before exiting the function. In this homework, these tokens are case insensitive. For example, "Hello" and "hello" are considered to be the same token.
Implement the selection sort algorithm to sort a vector<TokenFreq> in ascending order of token frequency. The pseudo code of the selection algorithm can be found at http://www.algolist.net/Algorithms/Sorting/Selection_sort You can also watch an animation of the sorting process at http://visualgo.net/sorting -->under "select". This function has the following prototype:
void selectionSort( vector<TokenFreq> & tokFreqVector ); This function receives a vector of TokenFreq objects by reference and applies the selections sort algorithm to sort this vector in increasing order of token frequencies.
Implement the insertion sort algorithm to sort a vector<TokenFreq> in descending order of token frequency. The pseudo code of the selection algorithm can be found at http://www.algolist.net/Algorithms/Sorting/Insertion_sort Use the same link above to watch an animation of this algorithm. This function has the following prototype:
void insertionSort( vector<TokenFreq> & tokFreqVector );
Implement the void writeToFile( vector<TokenFreq> &tokFreqV, string outFileName); function. This function receives a vector of TokenFreq objects and writes each token and its frequency on a separate line in the specified output file.
Implement the int main() function to contain the following features: (1) asks the enduser of your program to specify the name of the input file, (2) ) call the getTokenFreq() to identify each unique token and its frequency, (3) call your selection sort and insertion sort functions to sort the vector of TokenFreq objects assembled in (2); and (4) call the WriteToFile() function to print out the sorted vectors in two separate files, one in ascending order and the other in descending order.
Example input and outputs:
Assume that your input file contains the following paragraph: ï»ż"And no, I'm not a walking C++ dictionary. I do not keep every technical detail in my head at all times. If I did that, I would be a much poorer programmer. I do keep the main points straight in my head most of the time, and I do know where to find the details when I need them. by Bjarne Stroustrup"
After having called the getTokenFreq() function, you should identify the following list of (token, freq) pairs and store them in a vector (note that the order might be different from yours): {'no,': 1, 'and': 1, 'walking': 1, 'be': 1, 'dictionary.': 1, 'Bjarne': 1, 'all': 1, 'need': 1, 'Stroustrup': 1, 'at': 1, 'times.': 1, 'in': 2, 'programmer.': 1, 'where': 1, 'find': 1, 'that,': 1, 'would': 1, 'when': 1, 'detail': 1, 'time,': 1, 'to': 1, 'much': 1, 'details': 1, 'main': 1, 'do': 3, 'head': 2, 'I': 6, 'C++': 1, 'poorer': 1, 'most': 1, 'every': 1, 'a': 2, 'not': 2, "I'm": 1, 'by': 1, 'And': 1, 'did': 1, 'of': 1, 'straight': 1, 'know': 1, 'keep': 2, 'technical': 1, 'points': 1, 'them.': 1, 'the': 3, 'my': 2, 'If': 1}
After having called the selectionSort() function, the sorted vector of token-freq pairs will contain the following information (again, the tokens of the same frequency might appear in different order from yours) : [('no,', 1), ('and', 1), ('walking', 1), ('be', 1), ('dictionary.', 1), ('Bjarne', 1), ('all', 1), ('need', 1), ('Stroustrup', 1), ('at', 1), ('times.', 1), ('programmer.', 1), ('where', 1), ('find', 1), ('that,', 1), ('would', 1), ('when', 1), ('detail', 1), ('time,', 1), ('to', 1), ('much', 1), ('details', 1), ('main', 1), ('C++', 1), ('poorer', 1), ('most', 1), ('every', 1), ("I'm", 1), ('by', 1), ('And', 1), ('did', 1), ('of', 1), ('straight', 1), ('know', 1), ('technical', 1), ('points', 1), ('them.', 1), ('If', 1), ('in', 2), ('head', 2), ('a', 2), ('not', 2), ('keep', 2), ('my', 2), ('do', 3), ('the', 3), ('I', 6)]
In: Computer Science