You can use the "cat" command to list the content of a file. For example:
cat /etc/fstab
lists the content of the file /etc/fstab in the terminal window that you are currently using.
If you use a redirection of the standard output of the "cat' command:
cat /etc/fstab > foo
then a file named "foo" is created in the local directory and the content of the file /etc/fstab is listed by the "cat" command into the file "foo", which then contains a copy of the content of the file/etc/fstab. In that case, no output is printed to the terminal.
Execute the following command:
cat /etc/fstab > /dev/tty
What is the result? Explain why (do a search in the Unix manual: man -f tty for some help).
In: Computer Science
Write a Java program that accepts a sequence of commands and print out the number of successful insertions, the number of successful deletions, the number of successful searches (through the “find” command), the number of items remaining in the list after executing all commands and the final contents of the list.
Three commands that will be taken as inputs are “insert”, “delete” and “find”.
Input
Line 1: The number of transactions m on the list, where 1 m 200.
Line 2 to m+1: A string command (“insert”, “delete”, “find”) followed by an integer n (separated by a space).
Output
Line 1: Display 4 integers (each number is separated by a space) which are:
Line 2: The final contents of the list after executing all commands.
|
Sample Input |
Sample Output |
|
3 insert 1 delete 5 find 2 |
1 0 0 1 [ 1 ] |
|
8 find 10 insert 3 insert 2 insert 1 delete 4 delete 3 insert 1 find 2 |
4 1 1 3 [ 1 1 2 ] |
In: Computer Science
Write a function called 'make_triangle(char,n)' that uses a nested loop to return a string that forms a triangle. The return string should contain: one instance of char on the first line, two instances of char on the second line, and so on up to n instances of char on line n. Then n-1 instances of char on line n+1, and so on until the triangle is complete. Sample runs of the function looks as follows (this function called from IDLE, please note the end of line character at the end of the return string):
>>> make_triangle("+",6)
'+\n++\n+++\n++++\n+++++\n++++++\n+++++\n++++\n+++\n++\n+\n'
>>> make_triangle('*',3)
'*\n**\n***\n**\n*\n'
From IDLE, we could as print out the actual triangle as follows:
>>> print(make_triangle("+",6))
+
++
+++
++++
+++++
++++++
+++++
++++
+++
++
+
>>> print(make_triangle('*',3))
*
**
***
**
*
In: Computer Science
In: Computer Science
Topic of Discussion
“The implementation of realistic time management plans can improve productivity and the quality of life”.
As a project manager, discuss the key steps for creating realistic and successful time management plans.
In: Computer Science
Do a walk-through of the following program segments and determine, in each case, the exact output:
a) int i, j;
for (i = 1; i <= 5; i++)
{
for (j = 1; j <= 5; j++)
cout << setw (3) << i;
cout << endl;
}
b) int i, j;
for (i = 1; i <= 5; i++)
{
for (j = (i + 1; j <= 5; j++)
cout << setw(5) << j;
cout << endl;
c) int i, j;
for (i = 1; i <= 5, i++)
{
for (j = 1; j <= i; j++)
cout << setw(3) << j;
cout << endl;
In: Computer Science
Java Programming:
Scan a file and set up 3 different arrays from scanning through the .txt file. you should have 2 string arrays and 1 integer array.
I need help knowing how to read the file so that it puts the correct information into an array. It is all separated by spaces.
.txt file:
S SABQ138 3
A AABQ205 2
S SABQ127 1
A AABQ313 2
S SABQ126 2
A AABQ302 2
In: Computer Science
Java guessing game:
For this program you will use Linear Search.
- Ask the user to choose between a number from 0 to 2000.
- The user will guess how long the linear search will take in nanoseconds,
- After the user puts in their answer, show the user the difference between the actual answer and their answer.
(Example: The user puts in 5 nanoseconds. The actual time is 11 nanoseconds. The program will show 6 nanoseconds.)
There should be a class for the program to do the Linear Search and a separate tester class for the user questions and answers.
In: Computer Science
Evaluate the different types pf Back-Up which can be performed on Windows Server (2016/2019) and develop a back-up strategy for your organization which is a Large Bank in UAE with a branch office in each Emirate.
In: Computer Science
<Using C++ programming.>
<Prof said that you use the example given below.>
Write a program to find (A*B)*10 +
(2*C+D) using class Matrix.
For member functions, use add() and mul().
Add()
-a,b,c are all m*n matrices.
-Add(a,b,c,m,n): cij = aij + bij
-Add(a,m,n,num): cij = aij + num
Mul()
-a is an m*n matrix, b is an n*p matrix, and c is an m*p matrix.
-mul(a,b,c,m,n): (Matrix Multiplication)
-mul(a,m,n,num): aij = aij * num
In: Computer Science
I want to know 'Linked link + queue' and 'Linked link Stack' code in C++
But there is a condition. There shall be the following 'menu':
*****Menu*****
1. Insert into Stack 2. Insert into Queue
3. Delete from Stack 4. Delete from Queue
5. View Content in Stack 6. View Content in Queue
**********************************************
Let me give you a example.
>> 1 30 // Insert 30 into Stack
>>1 58// Insert 58 into Stack
>>1 26 // Insert 26 into Stack
>>3 // Delete from Stack
>>5 // View Content in Stack
Result: 58 30 ( Outputs in LIFO order)
Please help me. I am so curious.
In: Computer Science
Programming with Microsoft Visual Basic 2017:
Discuss the ORDER BY clause in the SELECT statement and how that can help simplify the data retrieved by the query.
In: Computer Science
A computer manufacturer offers the possibility of purchasing computers via the Internet. The customer can select a computer on the manufacture’s web page. The computers are classified into servers, desktops and portables. The customer can select a standard configuration or can build a desired configuration online. The configurable components are presented as pick lists of available options. For each new configuration, the system can calculate price. To place an order, the customer must fill out the shipment and payment information. Acceptable payment methods are credit cards and checks. Once the order has been entered, the system sends a confirmation e-mail message to the customer with details of the order. While waiting for the arrival of the computer, the customer can check the order status online at any time. The back end order processing consists of the steps needed to verify the customer’s credentials and payment method, to request the ordered configuration from the warehouse, to print an invoice, and to request the warehouse to ship the computer to the customer. Consider the following extended requirements: The customer uses the manufacturer’s online shopping web page to view the standard configuration of the chosen server, desktop or portable computer. The customer chooses to view the details of the configuration, perhaps with the intention of buying it as it or to build a more suitable configuration. The price for each configuration can be computed at the customer’s request. The customer may choose to order the computer online or may request that the salesperson contact him/her to explain order details, negotiate the price, etc. before the order is actually place. To place the order, the customer must fill out an online form with shipment and invoice address, and with payment details (credit card or cheque). After the customer’s order has been entered into the system, the salesperson sends and electronic request to the warehouse with details of the ordered configuration. The details of the transaction, including an order number and customer account number, are e-mailed to the customer, so that the customer can check the status of the order online. The warehouse obtains the invoice from the salesperson and ships the computer to the customer.
For the above Scenario draw the following UML diagrams
Q1: Identify actors, use-cases also draw use-case diagram with all possible associations?
In: Computer Science
In: Computer Science
Re-do Problem 1, but now implement the following method:
i must use this code :-
public static BagInterface intersection (BagInterface bagA, BagInterface bagB)
and here how my java program must work
This method must return a new bag which is the intersection of the two bags: bagA and bagB. An element appears in the intersection of two bags the minimum of the number of times it appears in either. For example, {1,1,2} ∩{1,1,2,2,3}= {1,1,2}. Do not forget to state the big O of your method implementation.
useing netbeans java
In: Computer Science