mirror of
https://github.com/ASDjonok/OOP_IO-2x_2023.git
synced 2026-04-01 13:20:39 +03:00
Compare commits
3 Commits
73c713708f
...
master_old
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
399941844f | ||
|
|
f385bff73d | ||
|
|
6d8171ad4c |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Project exclude paths
|
||||
/out/
|
||||
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="openjdk-18" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/OOP_IO-2x_2023.iml" filepath="$PROJECT_DIR$/OOP_IO-2x_2023.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
|
||||
public class Laba2
|
||||
{
|
||||
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
const int a = 2;
|
||||
int[][] b = new[]
|
||||
{
|
||||
new int[] { 1, 2, 8 },
|
||||
new int[] { 3, 4, 5 },
|
||||
new int[] { 6, 7, 9 }
|
||||
};
|
||||
calculation(b, a);
|
||||
}
|
||||
|
||||
private static int[][] calculation(int[][] b, int a)
|
||||
{
|
||||
int[][]c = new int[b.Length][b[0].Length]; //недопустимий специфікатор рангу: вимагається "," або "]";
|
||||
for (int i = 0; i < b.Length; i++)
|
||||
{
|
||||
c[i] = new int[b[i].Length];
|
||||
for (int j = 0; j < b[i].Length; j++)
|
||||
{
|
||||
c[i][j] = b[i][j] * a;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
class Lab3
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
string text = "Вухатий великий синiй слон. Яблуко в саду. Зелене яблуко? Груша. Жовта слива висить у саду!";
|
||||
Console.WriteLine(text );
|
||||
|
||||
// розділяємо текст на окремі речення
|
||||
string[] textSplit = text.Split(new[] { '.', '?', '!' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
// обчислюємо кількість слів у кожному реченні та створюємо масив з кількістю слів у реченнях
|
||||
int[] amountOfWords = new int[textSplit.Length];
|
||||
for (int i = 0; i < textSplit.Length; i++)
|
||||
{
|
||||
string[] words = textSplit[i].Trim().Split(' ');
|
||||
amountOfWords[i] = words.Length;
|
||||
}
|
||||
|
||||
// створюємо Dictionary, де ключ - кількість слів у реченні, а значення - речення
|
||||
Dictionary<int, string> sentenceDictionary = new Dictionary<int, string>();
|
||||
for (int i = 0; i < textSplit.Length; i++)
|
||||
{
|
||||
sentenceDictionary.Add(amountOfWords[i], textSplit[i]);
|
||||
}
|
||||
var sortedDict = sentenceDictionary.OrderBy(x => x.Key).ToDictionary(x => x.Value, x => x.Key);
|
||||
|
||||
|
||||
Console.WriteLine(String.Join(";", sortedDict.Keys));
|
||||
}
|
||||
}
|
||||
11
OOP_IO-2x_2023.iml
Normal file
11
OOP_IO-2x_2023.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,13 +1,36 @@
|
||||
public class Lab2 {
|
||||
public static void main(String[] args) {
|
||||
int[] array = {1, 2, 3};
|
||||
/*for (int i = 0; i < array.length; i++) {
|
||||
final int A = 2;
|
||||
final int[][] MATRIX_B = {
|
||||
{1, 202, 1, 1, 202, 3, 1, 202, 3,},
|
||||
{1, 202, 1, 1, 202, 3, 1, 202, 3,},
|
||||
{1, 1, 3, 1, 202, 3, 1, 202, 3,},
|
||||
// {4, 5, 6,},
|
||||
};
|
||||
|
||||
int[][] MATRIX_C = multiplication(A, MATRIX_B);
|
||||
|
||||
print(MATRIX_C);
|
||||
|
||||
System.out.println("Sum of smallest elements in every column: " + sumOfSmallestElementsInEveryColumn(MATRIX_C));
|
||||
|
||||
/*int[] array = {1, 2, 3};
|
||||
int[] array2 = new int[3];
|
||||
Object[] array3 = new String[3];
|
||||
System.out.println(array3[0]); //nothing, trash from the memory, null || null
|
||||
System.out.println(array2[0]); //nothing, trash from the memory, null || 0
|
||||
System.out.println(array[0]); // || 1
|
||||
|
||||
int[][] matrix2 = new int[2][3];
|
||||
matrix2[0] = new int[2];
|
||||
matrix2[1] = new int[1];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i % 2 == 0) {
|
||||
System.out.println("!" + array[i]);
|
||||
} else {
|
||||
System.out.println("?" + array[i]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
for (int i = 0; i < array.length; i+=2) {
|
||||
System.out.println("!" + array[i]);
|
||||
@@ -22,5 +45,58 @@ public class Lab2 {
|
||||
{1, 2},
|
||||
{3}
|
||||
};
|
||||
|
||||
// C=a×B, a - const
|
||||
|
||||
|
||||
// final int[][] MATRIX_C = int;
|
||||
|
||||
|
||||
MATRIX_B[0][0] = 2;
|
||||
MATRIX_B[0] = new int[]{1, 2};
|
||||
System.out.println(MATRIX_B[0][0]);
|
||||
MATRIX_B = new int[][]{
|
||||
{1, 2},
|
||||
{3}
|
||||
};*/
|
||||
}
|
||||
|
||||
private static int sumOfSmallestElementsInEveryColumn(final int[][] MATRIX_C) {
|
||||
// todo check different length of rows
|
||||
// todo try to change i and j
|
||||
// todo check repetition of minimal elements
|
||||
int sum = 0;
|
||||
for (int i = 0; i < MATRIX_C[0].length; i++) {
|
||||
int tmpSmallest = MATRIX_C[0][i];
|
||||
for (int j = 1; j < MATRIX_C.length; j++) {
|
||||
if (MATRIX_C[j][i] < tmpSmallest) {
|
||||
tmpSmallest = MATRIX_C[j][i];
|
||||
}
|
||||
}
|
||||
sum += tmpSmallest;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
private static void print(final int[][] MATRIX_C) {
|
||||
for (int i = 0; i < MATRIX_C.length; i++) {
|
||||
for (int j = 0; j < MATRIX_C[i].length; j++) {
|
||||
// System.out.print(MATRIX_C[i][j] + "\t");//printf("%4d",
|
||||
System.out.printf("%4d ", MATRIX_C[i][j]);//printf("%4d",
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
private static int[][] multiplication(int A, final int[][] MATRIX_B) {
|
||||
final int[][] MATRIX_C = new int[MATRIX_B.length][/*MATRIX_B[0].length*/]; // todo !!!DANGER different lengths of rows
|
||||
// final int[][] MATRIX_C = MATRIX_B;
|
||||
for (int i = 0; i < MATRIX_B.length; i++) {
|
||||
MATRIX_C[i] = new int[MATRIX_B[i].length];
|
||||
for (int j = 0; j < MATRIX_B[i].length; j++) {
|
||||
MATRIX_C[i][j] = MATRIX_B[i][j] * A;
|
||||
}
|
||||
}
|
||||
return MATRIX_C;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user