Web technologies (part #2), BSUIR 2018
- Be sure to use the Java Code Convention.
- Do not place the code of the entire application in one method (even if the task seems to be small and "there is nothing to write").
- Be sure to use the packages.
- Do not mix data-handling code and logic in the same class. Create different types of classes: classes, objects, store data, and classes which methods process the data. Place these classes in different packages.
- The requirement for JUnit-tests is mandatory.
- Name the variables, methods, class, and so on so that you can understand the purpose of the element.
Calculate the value of the expression by the formula (all variables accept valid values). For unit testing of an application create JUnit tests.
For a given region compile a program that prints true, if a point with coordinates (x, y) belongs to the shaded area, and false otherwise. Create JUnit tests.
Create a program to calculate the values of the function F(x) on the interval [a, b] with step h. Result should be presented as a table, the first column of which is the value of the argument, the second is corresponding function values. Create JUnit tests.
An integer array of dimension N is given. Print the indexes of the prime elements. Create JUnit tests.
An integer table A[n] is given. Find the smallest number of the elements you can throw out of the given sequence to get the increasing subsequence as long as possible. Create JUnit tests.
The real numbers a1, a2, ..., an are given. Get the next square order matrix n. Create JUnit tests.
Shell sort. An array of n real numbers is given. It is required to sort it by ascending order. This is done as follows: two neighboring elements ai and ai + 1 are compared. If ai <= ai + 1, then move forward one element. If ai > ai + 1, then swap the elements and shift one element back. Create an algorithm for this sorting.
Let two non-decreasing sequences of real numbers are given: a1 <= a2 <= ... <= an and b1 <= b2 <= ... <= bm. Specify the places on which to insert elements of the second sequence in the first sequence so that the new the sequence remained increasing.
Create a class Ball. Create a class Busket. Fill the basket with balls. Determine weight of the balls in the basket and the number of blue balls. For unit testing of the application create JUnit tests.
Compile and run the application created when solving the task #9 from the command lines.
Create a jar-file and run the application created when solving the task #9.
Without using code autogeneration tools, override the equals(), hashCode() and toString() methods for the Book class.
public class Book {
private String title;
private String author;
private int price;
private static int edition;
}
Not using code autogeneration override for the ProgrammerBook class methods equals(), hashCode() and toString().
public class ProgrammerBook extends Book {
private String language;
private int level;
}
Not using code autogeneration override for the Book class from the task #12 clone() method.
Add the ISBN field to the Book class from the task #12. Implement the Comparable interface in the Book class so that books acquire the default sorting according to the ISBN number. Write JUnit tests.
Implement comparators for the Book class from the task #12, which allow sorting books by name; by title, and then by author; by author, and then by name; by author, title and price. Write JUnit tests that validate sorts.
Karalina Dubitskaya
dubitskaya.karalina@gmail.com