Reference no: EM132369349
Task 1 -
Given a table invoice_items with the following structure:
create table invoice_items (
inv_num integer not null,
item varchar(10) not null,
price integer not null
);
Write an SQL query that returns a list of invoices (inv_num) with the total price of each (sum). The list should be ordered by inv_num (in descending order).
Task 2 -
Write a Bash script that computes the sum of the absolute values of integers given by standard input.
The numbers are given in a single line, separated by a space. You should print the sum of their absolute values to standard output.
In your solution, focus on correctness The performance of your solution will not be focus of the assessment.
Task 3 -
Write a Bash script that organizes a given directory.
We have a directory containing: music, videos, images, logs and perhaps other files. Your task is to organize files into categories and get rid of some of them.
Specifically, after your script has made changes, the directory should appear as follows:
- a new directory, "music", should contain all files with ".mp3" and ".flac" extensions;
- a new directory, "images", should contain all files with ".jpg" and ".png" extensions;
- a new directory, "videos", should contain all files with ".avi" and ".mov" extensions;
- all files with the ".log" extension should removed;
- other files not already mentioned in this list must hot be changed.
Task 4 -
Consider N coins aligned in a row. Each coin in showing either heads or tails. The adjacency of these coins is the number of pair of adjacent coins showing the same face.
You are given an implementation of a function:
class solution { public int solution(int[] A); }
that, given a non-empty array A consisting of N integers representing the coins, returns the maximum possible adjacency that can be obtained by reversing exactly one coin (that is, one of the coins must be reversed). Consecutive elements of array A represent consecutive coins in the row. Array A contains only 0S and/or 1s:
- 0 represents a coin with heads facing up;
- 1 represents a coin with tails facing up.
Attachment:- Assignment File - Tasks.rar