Skip to content

Commit fcb05be

Browse files
committed
added print_descending command
1 parent 2827274 commit fcb05be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+46
-1834
lines changed
-74.7 KB
Binary file not shown.

lab1/Lab1_prog.docx

-74.7 KB
Binary file not shown.

lab1/lab1.iml

-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +0,0 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<module type="JAVA_MODULE" version="4">
3-
<component name="NewModuleRootManager" inherit-compiler-output="true">
4-
<exclude-output />
5-
<content url="file://$MODULE_DIR$">
6-
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7-
</content>
8-
<orderEntry type="inheritedJdk" />
9-
<orderEntry type="sourceFolder" forTests="false" />
10-
</component>
11-
</module>

lab1/src/Main.java

-39
Original file line numberDiff line numberDiff line change
@@ -1,39 +0,0 @@
1-
import java.lang.Math.*;
2-
3-
public class Main {
4-
public static void main(String args[]) {
5-
int maxInt = 18, minInt = 4, lenD = (maxInt - minInt) / 2 + 1, lenX = 19;
6-
int gSizeI = 8, gSizeJ = 19;
7-
8-
int[] d;
9-
d = new int[lenD];
10-
float[] x;
11-
x = new float[lenX];
12-
13-
for (int i1 = 0; i1 < lenD; i1++) {
14-
d[i1] = minInt + i1 * 2;
15-
}
16-
for (int i2 = 0; i2 < x.length; i2++) {
17-
x[i2] = (float) (Math.random() * 18 - 14);
18-
}
19-
20-
double[][] g = new double[gSizeI][gSizeJ];
21-
for (int i = 0; i < gSizeI; i++) {
22-
for (int j = 0; j < gSizeJ; j++) {
23-
if (d[i] == 10)
24-
g[i][j] = Math.pow(2 / Math.pow(Math.pow(2 * x[j], 2), (1 - x[j] / 0.25) / 2), 2);
25-
else if (d[i] == 4 || d[i] == 12 || d[i] == 14 || d[i] == 16)
26-
g[i][j] = 2 * Math.pow(x[j], (x[j] + 1) / 0.25) / 1 / 2;
27-
else
28-
g[i][j] = Math.log(Math.pow(Math.E, Math.pow(Math.pow(Math.E, Math.pow(x[j], (1 - x[j]) / x[j])), 2 * Math.atan(Math.pow(Math.E, -Math.abs(x[j]))))));
29-
}
30-
}
31-
32-
for (double[] i: g) {
33-
for (double j : i) {
34-
System.out.printf(" %.4f ", j);
35-
}
36-
System.out.println();
37-
}
38-
}
39-
}

lab2/Java_lab2_theory.txt

-90
Original file line numberDiff line numberDiff line change
@@ -1,90 +0,0 @@
1-
1) Ооп - это методология программирования, в которой программа представляется в виде взаимодействия объектов
2-
3-
Наследование - это отношение классов, при котором подкласс наследует методы и поля родительского класса
4-
5-
Полиморфизм - это свойство, которое позволяет переопределять родительские методы и создавать
6-
одноимённые методы с различным наборов параметров
7-
8-
Позволяет ли полиморфизм возвращать разное количество объектов?
9-
10-
Можно ли в переопределённо родительском методе возвращать другое кол-во объектов?
11-
нет, может возвращать только один, тот, который мы указываем в родительском методе.
12-
13-
Инкапсуляция - это сокрытие, т.е. объявление переменных класса приватными и добавление для каждого из них getr() и setr()
14-
Т.е. разграничение доступа
15-
16-
Асбтракция - это описание в классе только основных методов и свойств объектов
17-
18-
Класс - шаблон, описывающий свойства и методы объекта
19-
*это экземпляр класса
20-
21-
Объект - экземпляр класса
22-
23-
Члены класса - поля данных и методы
24-
25-
Модификаторы доступа - privae default protected public
26-
27-
1) только в классе
28-
2) в классе, в package, в подклассе этого package
29-
3) 2) + в другом package
30-
4) 3) + везде
31-
32-
создание и инициализация объектов java - просто new и всё
33-
выделяется память
34-
35-
static - может быть у полей и методов
36-
могут использоваться без создания объектов класса
37-
то есть не нужно создавать объект класса машина
38-
39-
final класс нельзя наследовать
40-
final метод метод нельзя переобпределять
41-
переменную тоже
42-
43-
олласти
44-
45-
46-
47-
Два варианта реализации полиморфизма в Java:
48-
49-
Overloading – перегрузка метода
50-
Overriding – переопределение метода
51-
52-
конструктор - метод, иницилизирующий объект, создаваемый с помощью new
53-
54-
55-
static
56-
для перменных - переменная будет не для одного объекта, а для класса
57-
значит когда мы её меняем, она меняется для всех объектов этого класса
58-
59-
для методов -
60-
61-
для классов
62-
63-
64-
65-
66-
67-
68-
69-
Каверзные вопросы:
70-
71-
1) Можем ли мы переопределить статический метод в Java?
72-
- нет, не можем, потому что статический метод не связан с каким либо экземпляром класса.
73-
2) Что такое суперкласс?
74-
- это класс, на основе которого создаются другие классы
75-
3) Абстракция - это?
76-
77-
Абстрактный класс - основа для всех дочерних классов
78-
и в нём нельзя создавать объекты!
79-
80-
Для статических методов можно ли overload, overriding?
81-
- overload можно, override нельзя!
82-
Абстрактный метод
83-
84-
85-
Конструктор - это
86-
87-
88-
89-
90-

lab2/Lab2_prog.docx

-464 KB
Binary file not shown.

lab2/Lab2_prog.iml

-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +0,0 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<module type="JAVA_MODULE" version="4">
3-
<component name="NewModuleRootManager" inherit-compiler-output="true">
4-
<exclude-output />
5-
<content url="file://$MODULE_DIR$">
6-
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7-
</content>
8-
<orderEntry type="inheritedJdk" />
9-
<orderEntry type="sourceFolder" forTests="false" />
10-
<orderEntry type="library" name="Pokemon" level="project" />
11-
<orderEntry type="library" name="Lab2_prog" level="project" />
12-
</component>
13-
</module>

lab2/Pokemon.jar

-25.4 KB
Binary file not shown.

lab2/UML_diagram.png

-86.8 KB
Loading

lab2/lab2.iml

-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +0,0 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<module type="JAVA_MODULE" version="4">
3-
<component name="NewModuleRootManager" inherit-compiler-output="true">
4-
<exclude-output />
5-
<content url="file://$MODULE_DIR$">
6-
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7-
</content>
8-
<orderEntry type="inheritedJdk" />
9-
<orderEntry type="sourceFolder" forTests="false" />
10-
<orderEntry type="library" name="Pokemon" level="project" />
11-
</component>
12-
</module>

lab2/src/Main.java

-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
import pokemons.*;
2-
import ru.ifmo.se.pokemon.*;
3-
4-
public class Main {
5-
public static void main(String[] args) {
6-
Battle b = new Battle ();
7-
Minior p1 = new Minior("rtx3090", 5);
8-
TapuFini p2 = new TapuFini("ПчелоВеЧищЕ", 5);
9-
Silvally p3 = new Silvally("АлександрⅠ", 5);
10-
Togekiss p4 = new Togekiss("Клименков", 5);
11-
Togetic p5 = new Togetic("Чернорабочий", 5);
12-
Togepi p6 = new Togepi("Василий", 5);
13-
b.addAlly(p1);
14-
b.addAlly(p2);
15-
b.addAlly(p3);
16-
b.addFoe(p4);
17-
b.addFoe(p5);
18-
b.addFoe(p6);
19-
b.go();
20-
}
21-
}

lab3/Lab3_prog.iml

-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +0,0 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<module type="JAVA_MODULE" version="4">
3-
<component name="NewModuleRootManager" inherit-compiler-output="true">
4-
<exclude-output />
5-
<content url="file://$MODULE_DIR$">
6-
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7-
</content>
8-
<orderEntry type="inheritedJdk" />
9-
<orderEntry type="sourceFolder" forTests="false" />
10-
</component>
11-
</module>

lab3/Lab3_prog_UML.puml

-150
Original file line numberDiff line numberDiff line change
@@ -1,150 +0,0 @@
1-
@startuml ClassesModel
2-
3-
enum CosmicObjectType {
4-
STAR
5-
ASTEROID
6-
PLANET
7-
GALAXY
8-
SATALITE
9-
}
10-
11-
interface Lightable {
12-
+ double light()
13-
}
14-
15-
interface Reflectable {
16-
+ double reflect(Light otherLight)
17-
}
18-
19-
interface Viewable {
20-
+ String getView(CosmicObject viewPoint)
21-
}
22-
23-
note bottom of Viewable
24-
This interface is used for objects, that can be seen by humans
25-
from other cosmic objects.
26-
end note
27-
28-
CosmicObject -- CosmicObjectType
29-
abstract class CosmicObject implements Viewable {
30-
# CosmicObjectType type
31-
# int brightness
32-
# String name
33-
# double radius
34-
# double mass
35-
36-
+ CosmicObject(String name, double radius, double mass)
37-
38-
+ CosmicObjectType getType()
39-
+ int getBrightness()
40-
+ Strign getName()
41-
}
42-
43-
note bottom of CosmicObject
44-
This is the base class for all objects in the universe.
45-
end note
46-
47-
class Star extends CosmicObject implements Lightable {
48-
# CosmicObjectType type = STAR
49-
+ Star(String name, double radius, double mass, int brightness)
50-
51-
+ String light()
52-
}
53-
54-
class Sun extends Star {
55-
# type = STAR
56-
# name = Sun
57-
# brightness = 50
58-
# radius = 696 340
59-
# mass = 1.98892 * 10^30
60-
+ Sun()
61-
}
62-
63-
64-
class Earth extends CosmicObject implements Reflectable {
65-
# type = PLANET
66-
# brightness = 2
67-
# name = Earth
68-
# mass = 5.9742 * 10^24
69-
# radius = 6371
70-
71-
+ Earth()
72-
+ Light reflect(Light otherLight)
73-
}
74-
75-
76-
class Moon extends CosmicObject implements Reflectable {
77-
# type = SATALITE
78-
# brightness = 1
79-
# name = Moon
80-
# mass = 7.36 * 10^22
81-
# radius = 1737.4
82-
+ Moon()
83-
+ Light reflect(Light otherLight)
84-
}
85-
86-
class Sky implements Viewable {
87-
# CosmicObject[] objects
88-
89-
+ String getView(CosmicObject viewPoint)
90-
}
91-
92-
abstract class Human implements Viewable {
93-
# String name
94-
# CosmicObject location
95-
96-
+ String getName()
97-
+ CosmicObject getLocation()
98-
+ see(Viewable target)
99-
+ read()
100-
+ write()
101-
+ draw()
102-
}
103-
104-
note top of Human
105-
This is the base class for all humans in the universe.
106-
see() methods call getView() method of class Viewable object
107-
Method read(), write() and draw() can check brightness of object before running.
108-
end note
109-
110-
class Znayka extends Human {
111-
# name = Znayka
112-
+ Znayka()
113-
+ see(Viewable target)
114-
+ read()
115-
+ write()
116-
+ draw()
117-
}
118-
119-
note top of Fuksy
120-
I find out, that Fuksy, Seledochka and ProfessorZvizdochkin are Neznayka's companions.
121-
end note
122-
123-
class Fuksy extends Human {
124-
# name = Fuksy
125-
+ Fuksy()
126-
+ see(Viewable target)
127-
+ read()
128-
+ write()
129-
+ draw()
130-
}
131-
132-
class Seledochka extends Human {
133-
# name = Seledochka
134-
+ Seledochka()
135-
+ see(Viewable target)
136-
+ read()
137-
+ write()
138-
+ draw()
139-
}
140-
141-
class ProfessorZvizdochkin extends Human {
142-
# name = ProfessorZvizdochkin
143-
+ ProfessorZvizdochkin()
144-
+ see(Viewable target)
145-
+ read()
146-
+ write()
147-
+ draw()
148-
}
149-
150-
@enduml

lab3/Programming_theory.md.html

-251
Large diffs are not rendered by default.

lab3/Programming_theory.md.pdf

-492 KB
Binary file not shown.

lab3/READ_BEFORE_LAB

-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +0,0 @@
1-
This UML diagram got accepted, but it is a bit different from final result,
2-
so, because I have literally zero time to change it, do not rely on it this much.
3-
It has a very cool logic, that is the most important thing. But overall,
4-
there is a lot of changes in methods and other stuff in /src directory.
5-
6-
Go check it yourself now!)
7-
8-
But overall, this UML is pretty good, not gonna lie.

lab3/UML_true.png

-137 KB
Loading

lab3/lab3.iml

-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +0,0 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<module type="JAVA_MODULE" version="4">
3-
<component name="NewModuleRootManager" inherit-compiler-output="true">
4-
<exclude-output />
5-
<content url="file://$MODULE_DIR$">
6-
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7-
</content>
8-
<orderEntry type="inheritedJdk" />
9-
<orderEntry type="sourceFolder" forTests="false" />
10-
</component>
11-
</module>
Original file line numberDiff line numberDiff line change
@@ -1,13 +0,0 @@
1-
package CosmicObjects;
2-
3-
public enum CosmicObjectType {
4-
STAR,
5-
ASTEROID,
6-
PLANET,
7-
GALAXY,
8-
SATELLITE,
9-
COMET,
10-
NEBULA,
11-
CONSTELLATION,
12-
FIRMAMENT
13-
}

0 commit comments

Comments
 (0)