0% found this document useful (0 votes)
14 views

JavaLabEN#1

Uploaded by

julia.iv.bi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

JavaLabEN#1

Uploaded by

julia.iv.bi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

1 EXPLORE THE ECLIPSE IDE.

CREATING AND DEBUGGING PROGRAMS

1.1 Purpose of work

Explore the capabilities of the Eclipse environment. Creation and debugging of


programs. Obtaining practical skills in developing algorithms and creating programs
in the Java language.

1.2 Organization of independent work of students

While preparing for practical work, it is necessary to study an specific task,


develop an algorithm for solving the task and prepare the text of the program to
implement the developed algorithm, prepare the corresponding sections of the report
and study the corresponding theoretical material presented in the lectures:
“Fundamentals of the Java language, program structure, types of variables",
"Operations in the Java language: arithmetic, bitwise, logical", "Flow Control
Statements in the Java Language” and recommended tutorials and tutorials. While
studying theoretical material, you need to know that any program (project) in Java
consists of files. The files are compiled by the Java compiler independently of each
other.

Library of math functions

To work with mathematical, trigonometric functions, the static class Math is


used. It is in the java.lang.Math package, which is automatically included in the
program.
Usage example:

double a = 0.55;
double rez = Math.sin(a);

Random numbers
To generate random numbers, you can use either the method

double b = Math.random();

It only generates fractional numbers.


Or use the Random class. It is in the package ( java.util.Random library). It needs
to be imported into the project:
import java.util.Random;

Using:

Random rnd = new Random();

Use one of the above methods:

rnd.nextDouble();
rnd.nextFloat();
rnd.nextGaussian();
rnd.nextInt();
rnd.nextInt(int max);
rnd.nextLong();

Scope of function definition

In some of the tasks below, there are intervals where the function value cannot
be found. In these cases, your program must return NaN .

Double.NaN

In some cases, the function value may be so small or big that its cannot be
represented in the double. In these cases, you can see the value of -Infinity or
Infinity value.

Double.NEGATIVE_INFINITY;
Double.POSITIVE_INFINITY;

How to pass command line arguments into your main method

Class with main method:

public class Test {


public static void main(String[] args) {
// ...
}
}

Create another one class that call main method of the class above:

public class Demo {


public static void main(String[] args) {
Test.main(new String[]{"5", "12", "argN"});
}
}

The array output should be as follows:

Your variable [1, 2, 3, 4]

1.3 Options for individual assignments

Project name:

Practice1

Package name:

ua.nure.cpp.your_last_name.practice1

Additionally, create the class ua.nure.cpp.your_last_name.practice1.Demo that


demonstrates developed functionality.
Each PartN class should contain a main method that demonstrates the
functionality of its own class.

Task 1. Function calculation

Class name

ua.nure.cpp.your_last_name.practice1.Part1

1. Display the results of the function calculation:

2,3, 𝑖𝑓 х > 2,3;


𝑦={ 𝑥2
𝑎− , 𝑖𝑓 х ≤ 2,3;
2

a5 + b, if b < 0;
a
a2 + , if 0 ≤ b ≤ 1.5;
x= a−b
a + ba + b2 , if 1.5 < b < 2.5;
3 2
4
{a , if 2.5 ≤ b.
Variable 𝑎 takes values from the range [0, 5] with a step of 0.5.
Variable 𝑏 takes values from the range [-2, 4] with a step of 0.1.

2. Display the results of the function calculation:

4.1, 𝑖𝑓 х > 3;
𝑦={ 𝑥3
𝑎− , if 𝑥 ≤ 3;
2

𝑎4 + b, 𝑖𝑓 𝑏 < 0;
5
2 √𝑎
𝑥= 𝑎 + ,
if 0 ≤ b ≤ 5, a ≠ b;
𝑎−b
a3 + 4a + b2 , if 5 < b < 8;
2

{𝑎5 if 8 ≤ b.

Variable 𝑎 takes values from the range [0, 5] with a step 0.5. Variable 𝑏 takes values
from the range [-3, 11] with a step 0.1.

3. Display the results of the function calculation:

𝑙𝑛(𝑎−𝑐)
𝑃 = 3𝑚2 − ;
b3 +a

𝑏 = 0,75 ∙ 𝑎2 + 𝑐 𝑚

𝑙𝑛(𝑡+𝑑2 )
3 , if 𝑑 > 𝑡, 𝑡 > 1;
√𝑡 2 𝑑
𝑎 = {2𝑡 𝑠𝑖𝑛( 𝑑 2), if 𝑡 > 1;
𝑡 3 𝑑, in other cases.

Variable 𝑑 takes values from the range [0, 5] with a step 1.1, variable 𝑡 takes values
from the range [0, 3] with a step 0.2; m = 3. Variable c takes a value from the
command line arguments.

4. Display the results of the function calculation:

2,35 𝑚2 + 𝑙−𝑚𝑥 − 𝑎2 , if 𝑚 < 0;


r={ b
b ⋅ 𝑡𝑔 ( ) , if 𝑚 ≥ 0;
2𝑚
𝑎 𝑠𝑖𝑛 (𝑥 − 3) , 𝑖𝑓 b > 0;
𝑡 = {𝑙𝑛(𝑐+b)2
2
, if b > 0, c < 20.
b +с−4

The variable m takes values from the range [-5, 5] with a step 0.5; 𝑎 = 3; variable
𝑏 takes values from the range [–3, 3] with a step 1; variable с takes values from the
range [0,50] with a step 10. Variables (x, l) take values from the command line
arguments.

5. Display the results of the function calculation:

𝑎
2
, 𝑖𝑓 a ≠ 0 𝑎𝑛𝑑 a ≠ 𝜋;
𝑦 = {𝑙𝑛(𝑠𝑖𝑛 𝑎)
𝑐𝑜𝑠(𝑥 2 + 𝑎), 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠;

a + 𝑏 − (3.5с + √|𝑏|) a, 𝑖𝑓 𝑏 ≤ 0;
х = {𝑡𝑔 𝑏 + a , 𝑖𝑓 𝑏 > 0.5;
𝑏
3.5a𝑏, 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠.

The variable a takes values from the range [0, 4] with a step 0.1; the variable b
takes values from the range [2, 5] with a step 0.2. The variable c takes value from the
command line arguments.

6. Display the results of the function calculation:

b = 0.25a2 + с𝑚 ;

𝑙𝑛(𝑡 + 𝑑 2 ) , 𝑖𝑓 𝑑 > 𝑡, 𝑡 > 1, 𝑑 > 1;


𝑎 = {√𝑡𝑑, 𝑖𝑓 𝑡 > 1;
𝑡 2𝑑, in other cases.

𝑙𝑛(𝑎2 −𝑑)
с = 3𝑚 − .
𝑎3 −𝑑

The variable d takes values from the range [0, 3] with a step 1; the variable t
takes values from the range [0, 4] with a step 0.5. The values of variables (с, a, m)
should be given from the command line arguments.
7. The line segments 𝑎 , b, с, 𝑑 are given. For each triple of those segments
from which a triangle can be constructed, determine and show on the screen squares of
those triangles.
8. For a triple of natural numbers, determine greatest common divisor.
9. The coordinates of the vertices of the triangle and the coordinates of the point
in it are given. Determine the distance of this point to the nearest midpoint of the side
of the triangle. (When solving the problem, take at least 3 options for the coordinates
of the vertices of the triangle and the point in it).
10. By the given value determine rest values:

3 6
√𝑎− √𝑎2 +1
𝑍= 7 .
1− √3+𝑎

𝑛
𝑦 = √𝑍 2

The 𝑎 variable takes values from the range [0, 3] with a step 1.2, the variable n
takes values from the range [10, -56] with a step 5.

11. Display the results of the function calculation:

25
√(𝑎 − 24)26 − 45𝑥 , 𝑖𝑓 х > 2,3;
𝑦 = { 21 2 −23
√(𝑎 − 𝑥 ) , 𝑖𝑓 х ≤ 2,3;
2

𝑎5 + 6b, 𝑖𝑓 b < 0;
45𝑎
23𝑎2 + , 𝑖𝑓 0 ≤ b ≤ 1.5, a ≠ b;
𝑥= 𝑎−b
a8 + 2ba + b8, 𝑖𝑓 1.5 < b < 2.5;
2

{𝑎4 − 9𝑏 + 21𝑎𝑏, 𝑖𝑓 2.5 ≤ b.

The variable a takes values from the range [0, 5] with a step 0.5; the variable b
takes values from the range [-2, 4] with a step 0.1. Display the results of the function
calculation:

12. Display the results of the function calculation:


𝑥−78
|𝑥−56|+1
, 𝑖𝑓 х > 3;
y ={|(𝑥−2)3 |
, 𝑖𝑓 𝑥 ≤ 3;
𝑙𝑛(4−𝑥)

𝑎7 + 45b + 𝑎𝑏, 𝑖𝑓 b < −10;


45𝑎
+ 19𝑎, 𝑖𝑓 − 10 ≤ b < 0;
36𝑏
𝑥= 5
√8a3 + 41a2 − 7b 9 , 𝑖𝑓 5 < b < 8;
𝑎5 , 𝑖𝑓 8 ≤ b;
{0, in other cases.

The variable a takes values from the range [0, 5] with a step 0.5; the variable b
takes values from the range [-3, 11] with a step 0.1.

13. Display the results of the function calculation:

𝑏
𝑃 = √√|12 − 10𝑚| + 1 − 5𝑎 − 2𝑐 ;

𝑚+3
𝑏= √(|3𝑎 − 2| + 𝑐 )4;

(𝑝2 +5𝑝+4)𝑥
3 , 𝑖𝑓 𝑝 > 𝑥, 𝑥 > 1,
√𝑝3 𝑥 4
𝑡𝑔 𝑝 𝑥
𝑎= ( ) , 𝑖𝑓 𝑝 > 1;
𝑡𝑔 2 𝑝−1
𝑡𝑔 3 𝑥
{ , 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠.
6

The variable p takes values from the range [-3, 11] with a step 0.9; the variable
x takes values from the range [0, 3] with a step 0.3; m=3. The values of variables (с)
should be given from the command line arguments.

14. Display the results of the function calculation:

162−𝑡 + 2 ⋅ 43−𝑥 − 4𝑡𝑥 − 𝑎4 , 𝑖𝑓 𝑚 < 0;


r={ 3𝜋 5𝜋
𝑠𝑖𝑛 2 𝑡 ⋅ 𝑠𝑖𝑛 ( + 3𝑎) + 𝑐𝑜𝑠 ( − 2𝑡) , 𝑖𝑓 𝑚 ≥ 0;
2 2
𝑎 𝑐𝑜𝑠(7𝑥 − 6) + 𝑠𝑖𝑛 (𝑎𝜋) , 𝑖𝑓 𝑏 > 0;
𝑙𝑛(𝑐+𝑏)2
𝑡={ , 𝑖𝑓 𝑏 > 0, с < 20, 𝑏 ≠ −𝑐;
𝑏2 +с−4
2
𝑐𝑜𝑠 2 𝑏, 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠.

The variable m takes values from the range [-5, 5] with a step 0.5; a = 3; the
variable b takes values from the range [-3, 3] with a step 10; the variable c takes values
from the range [0, 50] with a step 10. The values of variables (x) should be given from
the command line arguments.

15. Determine the value of the function:

𝑐𝑜𝑠 9 𝑥 − 𝑐𝑜𝑠 7 𝑥 + 𝑐𝑜𝑠 3 𝑎 − 𝑐𝑜𝑠 𝑥 , 𝑖𝑓 𝑥 ≠ 0 and a ≠ 𝜋;


𝑦={
𝑠𝑖𝑛 3 𝑥 + 𝑠𝑖𝑛 5 𝑎 − 𝑠𝑖𝑛 4 𝑥, in other cases;

3ab − (|3.5 ⋅ с − 56| + √|b|) , 𝑖𝑓 b ≤ 0;


х = {𝑐𝑜𝑠 2 𝑎 + 𝑐𝑜𝑠 2 3 𝑏 − 𝑠𝑖𝑛2 2 𝑎𝑏 − 𝑠𝑖𝑛2 4 𝑏, 𝑖𝑓 b > 0.5;
2 2
3.5ab, in other cases.

The variable a takes values from the range [0, 5] with a step 0.1; the variable b
takes values from the range [-2, 5] with a step 0.2. The values of variables (c) should
be given from the command line arguments.

16. Display the results of the function calculation:

𝜋 𝜋 3𝜋 7𝜋
b = 𝑐𝑜𝑠 𝑎 ⋅ 𝑐𝑜𝑠 2 𝑐 − 𝑠𝑖𝑛 ( + 𝑚) 𝑠𝑖𝑛 ( + 4𝑚) + 𝑠𝑖𝑛 ( + 4𝑎) 𝑐𝑜𝑠 ( − 5𝑐);
4 4 4 4

𝑙𝑛(𝑡 + 𝑑 2 ) , 𝑖𝑓 𝑑 > 𝑡, 𝑡 > 1, 𝑑 > 1;


𝑎 = {√𝑡𝑑, 𝑖𝑓 𝑡 > 1;
𝑡 2𝑑, in other cases.

1 𝜋
с = 𝑡𝑔3 𝑎 − 1 + − 3𝑐𝑡𝑔 ( − 𝑏3 ) ⋅ 3𝑚.
𝑐𝑜𝑠 2 𝑑 2

The variable d takes values from the range [2, 15] with a step 1; the variable t
takes values from the range [0, 5] with a step 0.5; the variable m takes values from the
range [-2, 2] with a step 0.41. The values of variables (c, a) should be given from the
command line arguments.

17. Display the results of the function calculation:

𝑍 = 𝑡𝑔𝑥 + 𝑐𝑡𝑔𝑥 + 𝑡𝑔2 𝑥 + 𝑐𝑡𝑔2 𝑥 + 𝑡𝑔3 𝑥 + 𝑐𝑡𝑔3 𝑥,

5𝑛 1
√2⋅𝑛⋅0,54√𝑥−10 −162𝑛(√𝑥−1)
𝑦= { , 𝑍 ≠ 0;.
𝑍
0, 𝑍 = 0.

The variable x takes values from the range [0, 5] with a step 0.58; the variable n
takes values from the range [1, 5] with a step 0.5.

18. Display the results of the function calculation:

2 −8𝑎| 2 −8𝑎|
𝑍 = 17 ⋅ 2√|𝑎 − 8 + 2 ⋅ 4√|𝑎 .

𝑛
𝑦 = √𝑍 2

The variable a takes values from the range [0, 5] with a step 0.2; the variable n
takes values from the range [-5, 10] with a step 2.5.

19. Display the results of the function calculation:

4𝑥 3 − 6𝑎 + 1, 𝑖𝑓 х > 3.6;
𝑦 = { 3√5−𝑥
, 𝑖𝑓 х ≤ 3.6;
𝑎

1 1
7 (𝑎 + ) − 2 (𝑏 2 + ) , 𝑖𝑓 b < 0, a ≠ 0;
𝑏 𝑎2
8
𝑎3 − 𝑏 − |
2
, 𝑖𝑓 0 ≤ b ≤ 1;
𝑥= 𝑎3 −𝑏2 |+1
4√𝑎2 − 9𝑏 + 1, 𝑖𝑓 1 < b < 2;
7 3 7 −3 65
{ √(𝑎 − 𝑏) − √(|𝑏 − 𝑎| + 1) − 8
, 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠.
The variable a takes values from the range [0, 5] with a step 0.5; the variable b
takes values from the range [-2, 4] with a step 0.1.

20. Display the results of the function calculation:

√|12+𝑥−𝑥 2 | √|12+𝑥−𝑥 2 |
− , 𝑖𝑓 х > 12;
𝑥−11 2𝑥−9
y ={1+𝑐𝑜𝑠(2𝑥−2𝜋)+𝑐𝑜𝑠(4𝑥+2𝜋)−𝑐𝑜𝑠(6𝑥−𝜋)
2
− 2 𝑐𝑜𝑠 2 𝑥, 𝑖𝑓 𝑥 ≤ 12;
𝑐𝑜𝑠(2𝜋−2𝑥)+2 𝑐𝑜𝑠 (2𝑥+𝜋)−1

4 𝑎−𝑏 4 𝑏+𝑎
√ +√ , 𝑖𝑓 b ≠ −3, 𝑎 ≠ 4;
𝑏+3 𝑎−4
1−2 𝑐𝑜𝑠 2 2𝑎
𝜋 𝜋 , 𝑖𝑓 − 10 ≤ b < 0;
𝑥= 2𝑡𝑔(2𝑎− 4 )⋅𝑠𝑖𝑛2( 4 +2𝑏)
1 2𝑎−𝑥 𝑎+𝑏
+ − , 𝑖𝑓 b ≠ ±𝑎;
𝑎+𝑏 𝑎−𝑏 1
{√2 − 𝑎 + 4𝑏 − 3, 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠.

The variable a takes values from the range [0.1, 8] with a step 0.5; the variable
b takes values from the range [-3, 11] with a step 0.2.

21. Display the results of the function calculation:

𝑃 = √|2𝑎 − 1| + 3 + √|2𝑎 + 15| + 9;;

10𝑐 𝑎
𝑏=− ;
√|2𝑚−1|+5

1
4 𝑐𝑜𝑠 𝑝 ⋅ 𝑡𝑔𝑥 − 2 𝑐𝑜𝑠 2 𝑥 − , 𝑖𝑓 𝑝 > 𝑥, 𝑥 > 1
𝑐𝑜𝑠 2 𝑝
𝑎={ 1
( 𝑡𝑔𝑥 + 𝑐𝑡𝑔𝑦) ⋅ (2 𝑠𝑖𝑛 𝑥 + 𝑡𝑔𝑦), 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠.
2

The variable p takes values from the range [0, 15] with a step 0.741; the variable
x takes values from the range [0, 3] with a step 0.3; m=3. The values of variables (c, y)
should be given from the command line arguments.

22. Display the results of the function calculation:


𝜋 3𝜋
𝑐𝑡𝑔( +𝑎)⋅(1+𝑐𝑜𝑠( +2𝑥))
4 2
5𝜋 − 𝑐𝑡𝑔2𝛼, 𝑖𝑓 𝑚 < 0;
𝑐𝑜𝑠(2𝑡− )+2
2
r=
√2 − √|3 + 𝑎| + 2 + √|𝑥 + 4|, 𝑖𝑓 𝑚 ≥ 0;
{

𝑏 2𝑎 8𝑎2
− = , 𝑖𝑓 b ≠ ±𝑎, 𝑥 ≠ ±𝑎;
𝑥−𝑎 𝑥+𝑎 𝑏2 −𝑎2
𝑡= √𝑐 2 −16 5𝑎
+ √𝑏 − 3 > , 𝑖𝑓 𝑥 ≥ 3, с ≠ ±4, 𝑏 > 5;
√𝑥−3 √𝑥−3
2
{𝑎 − 2|𝑐| − 3𝑏, 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠.

The variable m takes values from the range [-5, 5] with a step 0.5; a=3; the
variable x takes values from the range [-3, 3] with a step 1; the variable c takes values
from the range [0, 50] with a step 10. The values of variables (x) should be given from
the command line arguments.

23. Display the results of the function calculation:

1−2 𝑠𝑖𝑛2 2𝑎 1+𝑡𝑔2𝑎


− , 𝑖𝑓 𝑥 ≠ 0 𝑎𝑛𝑑 a ≠ 𝜋;
𝑦={ 1−𝑠𝑖𝑛 4𝑎 𝑥
√|𝑥 2 + 3𝑥 + 2| − √|𝑥 2 − 𝑥 + 1| − 1, 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠;

3 3 6
√𝑎 + 6 − √𝑎 − 𝑏 = √𝑎2 + 𝑏2 , 𝑖𝑓 b ≤ 𝑎;
х = {√|4 − 4𝑎3 + 𝑏6 | + 6 + 𝑎 − 3√2, 𝑖𝑓 b > 0.5;
3 3 3 3 3 3
(𝑎 √𝑎 − 2𝑎 √𝑏 + √𝑎2 𝑏2 + √𝑎2 𝑏 − √𝑎𝑏2 ) ÷ √𝑎2 + 1, 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠.

The variable a takes values from the range [0, 5] with a step 0.1; the variable b
takes values from the range [-2, 5] with a step 0.2.

24. Display the results of the function calculation:

𝑐 2 +1 𝑚
b= + − 2.9𝑎;
2 √𝑎2 +1

𝑡 + 𝑑, 𝑖𝑓 𝑑 > 𝑡, 𝑡 > 10, 𝑑 < 1;


2
𝑎 = {2𝑡 − 𝑡𝑑 + 3𝑑 2 − 7𝑡 − 12𝑑 + 1, 𝑖𝑓 𝑡 > 1;
𝑡2 𝑑
, 𝑖𝑛 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒𝑠.
𝑡𝑔6
|𝑎2 −5𝑑+4|
с= |𝑑2 −4|
𝑚.

The variable d takes values from the range [-5, 5] with a step 1; the variable t
takes values from the range [0, 5] with a step 0.5; the variable m takes values from the
range [-2, 5] with a step 0.41.

25. Display the results of the function calculation:

1 1 𝑎+1
𝑍=( + ) ÷ (1 + √ ),
√𝑎+√𝑎+1 √𝑎+√𝑎+1 𝑎−1

𝑍 2 +𝑛 𝑛2 −𝑍+2
𝑦=| − .
𝑍 2 −𝑛+1|+3 |𝑛2 −𝑍−2|+2

The variable a takes values from the range [3, 15] with a step 0.58; the variable
n takes values from the range [1, 5] with a step 0.5.

Task 2. Working with arrays

Class name

ua.nure.cpp.your_last_name.practice1.Part2

Forbidden package:

java.util.*

The array output should be as follows:

[1, 2, 3, 4]
[5, 6, 7, 8]
[9, 10, 11, 12]
[13, 14, 15, 16]

1. For the given matrix (N+15)x(N+15) sort the main diagonal in ascending
order by moving rows or columns { отсортировать главную диагональ }. Generate
numbers randomly in the interval [-N-15; N+15]
2. For the given matrix (N+15)x(N+15) sort the even rows in ascending order,
and sort odd rows in descending order { отсортировать четные строки в прямом
порядке, а нечетные в обратном }. Generate numbers randomly in the interval [-N-
15; N+15]
3. For the given matrix (N+15)x(N+15) sort columns in descending order of sum
of numbers in columns { отсортировать столбцы по убыванию суммы чисел в
столбцах }. Generate numbers randomly in the interval [-N-15; N+15]
4. For the given matrix (N+15)x(N+15) sort elements on even rows only
{ отсортировать элементы только четных строках }. Generate numbers randomly
in the interval [-N-15; N+15]
5. For the given vector (N+15) sort even numbers in ascending order (odd
numbers should stay on their places) { отсортировать четные числа по возрастанию
(нечетные оставить на своих местах) }. Generate numbers randomly in the interval
[-N-15; N+15]
6. For the given matrix (N+15)x(N+15) sort each even column in ascending
order { отсортировать каждый четный столбец }. Generate numbers randomly in the
interval [-N-15; N+15]
7. For the given matrix (N+15)x(N+15) sort each even column in descending
order separately and each odd column in ascending order separately { отсортировать
четные столбцы в обратном порядке, а нечетные в прямом }. Generate numbers
randomly in the interval [-N-15; N+15]
8. For the given matrix (N+15)x(N+15) sort rows in ascending order of sum of
numbers in rows { отсортировать строки по возрастанию суммы чисел в этих
строках }. Generate numbers randomly in the interval [-N-15; N+15]
9. For the given matrix (N+15)x(N+15) sort each odd column in ascending order
{ отсортировать каждый нечетный столбец }. Generate numbers randomly in the
interval [-N-15; N+15]
10. For the given matrix (N+15)x(N+15) sort odd rows in ascending order
{ отсортировать нечетные строки }. Generate numbers randomly in the interval [-N-
15; N+15]
11. For the given vector (N+15) sort each even column in ascending order
{ отсортировать нечетные числа по убыванию (четные оставить на своих
местах) }. Generate numbers randomly in the interval [-N-15; N+15]
12. For the given matrix (N+15)x(N+15) determine the sum of numbers above
main diagonal and compare it with the sum of numbers below main diagonal (ignore
main diagonal). If the sum of top elements greater than the sum of bottom elements,
sort matrix in descending order otherwise sort matrix in ascending order { найти
сумму всех чисел стоящих выше главной диагонали и сравнить ее с суммой чисел
стоящих ниже (главную диагональ не учитывать). Если сумма верхних больше
суммы нижних, тогда отсортировать всю матрицу по убыванию, иначе по
возрастанию }. Generate numbers randomly in the interval [-N-15; N+15]
13. For the given matrix (N+15)x(N+15) { если сумма всех чисел в строках
больше суммы всех чисел в столбцах, тогда зеркально отобразить матрицу
относительно побочной диагонали, иначе отсортировать по возрастанию }.
Generate numbers randomly in the interval [-N-15; N+15]
14. For the given matrix (N+15)x(N+15) sort it in ascending order and write the
result in the form of a horizontal descending snake { отсортировать по возрастанию
и записать результат в виде горизонтальной нисходящей змейки }. Generate
numbers randomly in the interval [-N-15; N+15]

1 2 3
6 5 4
7 8 9
12 11 10

15. For the given matrix (N+15)x(N+15) determine if it is symmetric relative


the main diagonal { определить является ли она симметричной относительно
главной диагонали }. Generate numbers randomly in the interval [-N-15; N+15]
16. For the given matrix (N+15)x(N+15) sort it in descending order and write
the result in the form of a vertical descending snake { отсортировать по убыванию и
записать результат в виде вертикальной нисходящей змейки }. Generate numbers
randomly in the interval [-N-15; N+15]

10 3 2
9 4 1
8 5 0
7 6 -1

17. For the given matrix (N+15)x(N+15) if the sum of even numbers greater
than the sum of odd numbers, sort the matrix in ascending order otherwise in
descending order { если сумма четных чисел больше суммы нечетных, тогда
сортировать по возрастанию, иначе по убыванию }. Generate numbers randomly in
the interval [-N-15; N+15]
18. For the given matrix (N+15)x(N+15) find rows that contain maximum and
minimum elements and swap them. If rows match, zero them { найти строки с
максимальным и минимальным элементом и поменять их местами, если строки
совпадают, обнулить их }. Generate numbers randomly in the interval [-N-15; N+15]
19. For the given matrix (N+15)x(N+15) find the minimum element and subtract
its value from the surrounding elements. The matri { найти минимальный элемент и
вычесть его величину из окружающих его элементов. Матрицу рассматривать
как замкнутое пространство }. Generate numbers randomly in the interval [-N-15;
N+15]
20. For the given matrix (N*10+1)x(N*10+1) { отсортировать главную и
побочную диагонали, если стоящий в точке пересечения элемент совпадает,
тогда вернуть матрице исходный вид и отсортировать в прямом порядке все
четные столбцы, иначе отсортировать в обратном порядке все нечетные строки }.
Generate numbers randomly in the interval [-N-15; N+15]
21. For the given matrix (N+15)x(N+15) sort odd elements in ascending order
in the each even row, even element fill zero { отсортировать нечетные элементы в
каждой четной строке, все четные элементы обнулить }. Generate numbers
randomly in the interval [-N-15; N+15]
22. For the given matrix (2*N+5)x(2*N+5) sort each odd row, write the sum of
the elements of the previous odd row into each element of the even line
{ отсортировать каждую нечетную строку в каждый элемент четной строки
записать сумму элементов предыдущей нечетной строки }. Generate numbers
randomly in the interval [-N-15; N+15]
23. For the given matrix (N+15)x(N+15) find the sum of the matrix element.
Find the maximum element and fill zeros all elements in its row and column. Re-find
the sum of all the numbers in the matrix. If the sum of the original is greater, return the
matrix to its original form and sort all even rows, otherwise leave the matrix in the
transformed form { найти сумму всех чисел матрицы. Найти максимальный
элемент матрицы и обнулить все элементы, которые находятся в
соответствующем столбце и строке. Повторно найти сумму всех чисел матрицы.
Если сумма исходной больше, вернуть матрице исходный вид и отсортировать
все четные строки, иначе оставить матрицу в преобразованном виде }. Generate
numbers randomly in the interval [-N-15; N+15]
24. For the given matrix (N+15)x(N+15) find the sum of all the numbers in the
matrix. Find the smallest element and add its absolute value to each element of the
matrix. Calculate the sum of squares for both matrices { найти сумму всех чисел
матрицы. Найти минимальный элемент и прибавить его абсолютное значение к
каждому элементу матрицы. Рассчитать сумму квадратов для обеих матриц }.
Generate numbers randomly in the interval [-N-15; N+15]
25. For the given matrix (N+15)x(N+15) find the sum of the numbers in even
columns. Sort and re-find the sum, if the first sum is greater, return the original form
of the matrix and zero every odd row, if the second sum is larger, zero every even row,
leaving the matrix sorted { найти сумму чисел стоящих в четных столбцах.
Отсортировать и повторно найти сумму, если первая сумма будет больше,
вернуть исходный вид матрицы и обнулить каждую нечетную строку, если
вторая сумма окажется больше обнулить каждую четную строку, оставив
матрицу отсортированной }. Generate numbers randomly in the interval [-N-15;
N+15]

1.4 Questions

1. What parts does a Java program consist of? { Из каких частей состоит Java
- программа? }
2. What are the main types of variables in the Java language? { Назовите
основные типы переменных языка Java. }
3. What types of variables are basic? { Какие типы переменных являются
базовыми? }
4. Provide the characteristic of integer data types: int, char, short, long, byte.
{ Предоставьте характеристику целочисленных типов данных: int, char, short,
long. }
5. Provide a characteristic of floating point data types: float, double.
{ Предоставьте характеристику действительных типов данных: float, double. }
6. What are expressions in Java? { Что такое выражения в языке Java? }
7. What are the arithmetic operations that are used in the Java language?
{ Назовите арифметические операции, которые используются в языке Java? }
8. What are increment and decrement operations? Their forms. { Что такое
операции увеличения и уменьшения? Их формы. }
9. What are "increase by", "decrease by" operations? Their kind. { Что такое
операции "увеличение на", "уменьшение на"? Их разновидность. }
10. Which bitwise operations are used in Java? { Которые побитовые
операции используются в языке Java? }
11. What are the shift operations used in Java? { Какие операции смещения
используются в языке Java? }
12. Give a characteristic to the Java language flow control statements: if-else,
while, for. { Предоставьте характеристику управляющим конструкциям языка
Java: if-else, while, for. }
13. What are the main features of the Eclipse tool? { Назовите основные
возможности инструментального средства Eclipse. }

You might also like