Unix/Linux
1)
Use the find command to find all directories under /pub/cs/ whose
name is cs160a. Be sure to only display the results that match, do
not display any error output.
Hint: use: 2>/dev/null.
2)
Create a one-line command, using he famous.dat file, to add the
word " STREET" to the address, for all who live on 2nd or
3rd.
For example: '2nd' becomes "2nd STREET" and '3rd' becomes "3rd
STREET".
Display only the first 9 lines.
Hint: use 2 sed statements with pipes.
3)
Display all lines in famous.dat that end in 0 or 1, and have a 1 in
the 3rd from the last column.
For example lines ending in 120 and 131 would be displayed.
4)
Display all lines in famous.dat that have only 4, 5, 6, 7 and 9 in
the zip code.
HINT: this is the same as NOT 0,1,2,3 or 8.
5)
Using only the grep command, search all files with names that end
in either .html or .htm under the$HOME/public_html directory and
display any lines that contain body tags (containing
''). No other output should be displayed even if there
is no public_html directory.
Hint: use two command arguments and 2>
In: Computer Science
For this assignment, You will create a NodeJS application which takes a city name as an input in its pug template. using openweathermap API, you should get the weather of that particular city and displays that information to a new pug template. You should also store the results in a file in your directory. Following are the detailed requirements.
Your application should start with a pug template (similar to HTML page) which has a form with an input field and label to accept the city name and a button on clicking which we can send a GET request to the server.
Your server code (Back-end) should be able to take this city name, make an API call to the openweathermap API.
You should be able successfully to establish the API call and retrieve data from it.
You should also be able to display this data in a new pug template.
This same pug template will also have a form in which we should be able to enter the data you that we received from openweathermap.
On entering and submitting that data, You should be able to make a POST request to your back-end.
Your back-end code should write those values to a file in your local directory using async and fs.
Openweathermap API documentation: https://openweathermap.org/api
In: Computer Science
Could you please write "linkedlist.cpp" using recursive approach to manage a linked list for the given files below as well as an updated makefile.
// app.cpp
#include <iostream>
#include "linkedlist.h"
using namespace std;
void find(LinkedList& list, char ch)
{
if (list.find(ch))
cout << "found ";
else
cout << "did not find ";
cout << ch << endl;
}
int main()
{
LinkedList list;
list.add('x');
list.add('y');
list.add('z');
cout << list;
find(list, 'y');
list.del('y');
cout << list;
find(list, 'y');
list.del('x');
cout << list;
find(list, 'y');
list.del('z');
cout << list;
find(list, 'y');
return 0;
}
//-------------------
//linkedlist.h
#ifndef _LINKED_LIST_
#define _LINKED_LIST_
#include <ostream>
class LinkedList
{
public:
LinkedList();
~LinkedList();
void add(char ch);
bool find(char ch);
bool del(char ch);
friend std::ostream& operator<<(std::ostream& out,
LinkedList& list);
};
#endif // _LINKED_LIST_
//-------------------------
//makefile
CC = g++
CPPFLAGS = -Wall -g -std=c++11
app: app.o linkedlist.o
app.o: linkedlist.h
linkedlist.o: linkedlist.h
.PHONY: clean
clean: # clean the directory
$(info -- cleaning the directory --)
rm -f *.o
rm -f app
//-----------------------
In: Computer Science
1. What is the response rate of an online survey sent to 650 email recipients, where 100 email addresses were ineligible, 400 recipients responded to the survey, and 150 refused to participate? (Show all your work)
2. A department store manager believes that at least half of the households in a test market city contain at least one adult who has visited the store since the new layout was introduced. To conduct online surveys, a researcher working with this manager has purchased access to a 1,100 online panel with members located in the target area. The researcher asked the following question to the contacted respondent "Has any adult in this household visit XYZ department store in the previous month?". Here are the final results of the online panel surveys.
Completed surveys 426
Refusals 260
No Contact 0
Ineligible surveys 292
Nonworking emails 122
What is the response rate with eligibility requirements? Show all your work.
3. Knowing that you need a sample pool of 1019 students to ultimately get about 500 students in your sample, you are in a position to draw a systematic sample from the student directory at your university. Further, 9,500 students are listed in the directory. What is the sampling interval? Interpret your results. Show all your work
In: Statistics and Probability
Create a shell in C language
1) Create an argument tokenizer then write a main() function that prints a prompt inputed by user, accepts input, and tokenizes the input.
2) Use the argument vector to an executeCmd() function with int executeCmd(char **args);
3) The function should return a -1 if an error, or a zero otherwise. Inputing an “x” in the prompter will exit the program.
4) Write an executeCmd() function that can execute any program in the background and redirect the output of any program to a file. Any number of functions can be executed in executeCmd() such as listing the files in the current directory, listing files in long format or displaying current working directory (ls, ls -a, pwd).
5) The program should run in the background working on the function, but the prompt should be available to take new requests ($ cat prog.c &).
6) Function execBackground() should be used to determine when a job should run in the background. The function will strip the ‘&’ character from the argument vector. This function will also let the output of a running program to be redirected to a file ($ grep if prog.c > foo).
7) The maker should include two source files and one header file as well as a makefile. The main() function, the executeCmd() function and all supporting functions will be in a file program_exec.c and the function prototype for executeCmd() program_exec.h.
In: Computer Science
Build a module (file with pre-defined functions) that allows the following code to work properly. The code below should be able to run without any additions or modifications. You may copy and paste it into a file called file_tools_assignment.py and place it in the same directory as the file you will create. The filename of the file you will create should be file_tools.py. The module should contain 2 custom defined functions; get_file_string() and get_file_list(). Download the data.txt file and place it in the same directory with your other two files.
Contents for file_tools_assignment.py:
import file_tools filename = 'data.txt' contents = file_tools.get_file_string(filename) print(contents) list_of_lines = file_tools.get_file_list(filename) print(list_of_lines)
(5 points) The get_file_string() function should attempt to get the contents of a file and return it as a string. If no file exists, the return value should be None.
(5 points) The get_file_list() function should return a list where each element in the list corresponds to a line in the file. Note: no newline characters should be present in the elements of the list. Remove those before adding the elements to the list that gets returned. If no file exists, the return value should be an empty list.
Sample output (3 lines in data.txt):
hello world
I love programming
Python rocks!
['hello world', ' I love programming', 'Python rocks!']In: Computer Science
Question
The call center of a major energy provider expects to be particularly busy during the early shift in the early Winter. During the early shift calls arrive at a mean rate of 240 per hour and are believed to arrive at random.
(a) Explain briefly why it might be reasonable to expect these calls to arrive at random.
(b) What would be the probability distribution of the number of calls arriving during a five-minute period in the early shift? (There is no need to calculate any probabilities in this part of the question).
(c) Show (using probability tables or probability formulae) that the probability that there are more than 26 calls in a five-minute period is 0.0778. Show your working.
(d) Staffing levels during the early shift are such that they can cope with occasional peaks in arrivals, but service levels deteriorate rapidly when they experience a number of peaks close together. Continuing to assume that calls arrive at random, show that the probability that there are 6 or more five-minute periods in an hour in which the number of calls exceeds 26 is less than 1 in 1000. Show your working.
(e) Quiet periods only occur very rarely during the early shift in the call centre, so when gaps between calls exceed 2 minutes the management takes it as a signal of a telephone system failure and resets the system. What is the chance they reset the system unnecessarily in response to a 2 minute gap? Justify your method.
(f) You have seen in class how a Normal distribution can be used to approximate a Binomial distribution under certain conditions on n and p. (Remember that the Normal distribution was chosen to match the Binomial distribution in mean and standard deviation). A Normal distribution can also be used to approximate a Poisson distribution under certain conditions. By applying the same idea, use the Normal distribution to provide an approximate answer to part (c) above. Explain your method carefully.
(g) Suggest the conditions under which a Normal distribution can be used to approximate a Poisson distribution. Justify your answer.
In: Physics
Problem 8-3
On October 9, 2020, Steven Company purchased $4,500 of product on account from Bryant Company on with credit terms of 2/15 n/30. The product cost Bryant Company $3,750. The freight terms were F.O.B. shipping point, the cost was $125 and the freight was paid in cash to ABC Trucking Company on Oct 12, 2020.
On October 15, Bryant Company purchased $2,000 of product from Mitchell Company, with credit terms of 3/10, n/60. The product cost Mitchell Company $1,200. The freight terms were F.O.B. destination. the cost was $75 and the freight was paid in cash to ABC Trucking Company on October 16.
On October 17, Steven Company paid for the purchase made on October 9.
On October 30, Bryant Company paid for the purchase made on October 15.
Prepare the journal entries for Steven, Bryant, and Mitchell Companies. Calculate the gross margin on Bryant’s sale to Steven Company and on Mitchell’s sale to Bryant Company.
In: Accounting
Work in Process Account Data for Two Months; Cost of Production Reports. Pittsburgh Aluminum Company uses a process cost system to record the costs of manufacturing rolled aluminum, which consists of the smelting and rolling processes. Materials are entered from smelting at the beginning of the rolling process. The inventory of Work in Process—Rolling on September 1 and debits to the account during September were as follows:
| Bal., 1,200 units, 20% completed: | ||
| Direct materials (1,200 x $4.1) | $ 4,920 | |
| Conversion (1,200 x 20% x $1.7) | 408 | |
| $ 5,328 | ||
| From Smelting Department, 27,120 units | $113,904 | |
| Direct labor | 31,871 | |
| Factory overhead | 17,161 | |
During September, 1,200 units in process on September 1 were completed, and of the 27,120 units entering the department, all were completed except 2,100 units that were 60% completed. Charges to Work in Process—Rolling for October were as follows:
| From Smelting Department, 31,200 units | $137,280 |
| Direct labor | 40,410 |
| Factory overhead | 21,758 |
During October, the units in process at the beginning of the month were completed, and of the 31,200 units entering the department, all were completed except 1,600 units that were 90% completed.Required: 1. Enter the balance as of September 1 in a four-column account for Work in Process—Rolling. Record the debits and the credits in the account for September. Construct a cost of production report and present computations for determining (a) equivalent units of production for materials and conversion, (b) costs per equivalent unit, (c) cost of goods finished, differentiating between units started in the prior period and units started and finished in September, and (d) work in process inventory. If an amount box does not require an entry, leave it blank.
| ACCOUNT | Work in Process-Rolling Department | ACCOUNT NO. | ||||
|---|---|---|---|---|---|---|
| BALANCE | ||||||
| DATE | ITEM | POST. REF. | DEBIT | CREDIT | DEBIT | CREDIT |
| Sept. 1 | Bal., 1,200 units, 20% completed | |||||
| Sept. 30 | Smelting Dept., 27,120 units at $4.2 | |||||
| Sept. 30 | Direct labor | |||||
| Sept. 30 | Factory overhead | |||||
| Sept. 30 | Finished goods | |||||
| Sept. 30 | Bal., 2,100 units, 60% completed | |||||
2. Provide the same information for October by
recording the October transactions in the four-column work in
process account. Construct a cost of production report, and present
the October computations (a through d) listed in part (1).
| Costs | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Costs | Direct Materials | Conversion | Total Costs | |||||||||
| Cost per equivalent unit: | ||||||||||||
| Total costs for September in Rolling Department | $ | $ | ||||||||||
| Total equivalent units | ||||||||||||
| Cost per equivalent unit (b) | $ | $ | ||||||||||
| Costs assigned to production: | ||||||||||||
| Inventory in process, September 1 | $ | |||||||||||
| Costs incurred in September | ||||||||||||
| Total costs accounted for by the Rolling Department | $ | |||||||||||
| Costs allocated to completed and partially completed units: | ||||||||||||
| Inventory in process, September 1 balance (c) | $ | |||||||||||
| To complete inventory in process, September 1 (c) | $ | $ | ||||||||||
| Cost of completed September 1 work in process | $ | |||||||||||
| Started and completed in September (c) | $ | |||||||||||
| Transferred to finished goods in September (c) | $ | |||||||||||
| Inventory in process, September 30 (d) | ||||||||||||
| Total costs assigned by the Rolling Department | $ | |||||||||||
| ACCOUNT | Work in Process-Rolling Department | ACCOUNT NO. | ||||
|---|---|---|---|---|---|---|
| Balance | ||||||
| DATE | ITEM | POST. REF. | DEBIT | CREDIT | DEBIT | CREDIT |
| October 1 | Balance | |||||
| October 31 | Smelting Dept., 31,200 units at $4.4 | |||||
| October 31 | Direct labor | |||||
| October 31 | Factory overhead | |||||
| October 31 | Finished goods | |||||
| October 31 | Bal., 1,600 units, 90% completed | |||||
| Pittsburgh Aluminum Company Cost of Production Report-Rolling Department For the Month Ended October 31 |
|||
|---|---|---|---|
| Whole Units | Equivalent Units | ||
| Units | Direct Materials (a) | Conversion (a) | |
| Units charged to production: | |||
| Inventory in process, October 1 | |||
| Received from Smelting Department | |||
| Total units accounted for by the Rolling Department | |||
| Units to be assigned costs: | |||
| Inventory in process, October 1 | |||
| Started and completed in October | |||
| Transferred to finished goods in October | |||
| Inventory in process, October 31 | |||
| Total units to be assigned costs | |||
| Costs | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Costs | Direct Materials | Conversion | Total Costs | |||||||||
| Cost per equivalent unit: | ||||||||||||
| Total costs for October in Rolling Department | $ | $ | ||||||||||
| Total equivalent units | ||||||||||||
| Cost per equivalent unit (b) | $ | $ | ||||||||||
| Costs assigned to production: | ||||||||||||
| Inventory in process, October 1 | $ | |||||||||||
| Costs incurred in October | ||||||||||||
| Total costs accounted for by the Rolling Department | $ | |||||||||||
| Costs allocated to completed and partially completed units: | ||||||||||||
| Inventory in process, October 1 balance (c) | $ | |||||||||||
| To complete inventory in process, October 1 (c) | $ | $ | ||||||||||
| Cost of completed October 1 work in process | $ | |||||||||||
| Started and completed in October (c) | ||||||||||||
| Transferred to finished goods in October (c) | $ | |||||||||||
| Inventory in process, October 31 (d) | ||||||||||||
| Total costs assigned by the Rolling Department | $ | |||||||||||
In: Finance
Fitting Logistic Reegression (depedent varaible(Employed), Independent variables (Age, Race.Ethnicities, Education.Attainment, gender)
dataset
| Age | Earnings Past 12 Months | Usual Weekly Hours | Female | Married | No High School Degree | High School Degree or GED | Some College | Associates Degree | Bachelors Degree | Masters Degree | Professional Degree | Doctorate | Educational Attainment | Employed | White | Black | American Indian or Native American | Asian | Hawaiian or Pacific Islander | Other Race | Biracial | Hispanic | Race/Ethnicity | Worked 40+ Weeks During Past 12 Months | Worked 35+ Hours in a Typical Week | |||
| 18 | 1200 | 16 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | No High School Degree | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | White | 0 | 0 | |||
| 53 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | High School Degree | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | Hispanic | 0 | 0 | ||||
| 61 | 0 | 70 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | Some College | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | White | 1 | 1 | |||
| 32 | 350 | 24 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | Some College | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | White | 0 | 0 | |||
| 49 | 0 | 30 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | Masters Degree | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | White | 1 | 0 | |||
In: Statistics and Probability