Compare commits

...

2 Commits

Author SHA1 Message Date
xivihwa 830f117858
Create README.md 2023-05-18 02:43:11 +03:00
xivihwa dbe4b8119c lab4 2023-05-18 02:37:48 +03:00
24 changed files with 282 additions and 0 deletions

8
.idea/.gitignore vendored Normal file
View 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

9
.idea/OOP_IO-2x_2023.iml Normal file
View File

@ -0,0 +1,9 @@
<?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$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

11
.idea/modules.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/OOP_IO-2x_2023.iml" filepath="$PROJECT_DIR$/.idea/OOP_IO-2x_2023.iml" />
<module fileurl="file://$PROJECT_DIR$/lab1/lab1.iml" filepath="$PROJECT_DIR$/lab1/lab1.iml" />
<module fileurl="file://$PROJECT_DIR$/lab2/lab2.iml" filepath="$PROJECT_DIR$/lab2/lab2.iml" />
<module fileurl="file://$PROJECT_DIR$/lab3/lab3.iml" filepath="$PROJECT_DIR$/lab3/lab3.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

1
README.md Normal file
View File

@ -0,0 +1 @@
# Laboratory OOP - IO-2x - 2023

11
lab1/lab1.iml Normal file
View 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$/FunctionCalculator/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

11
lab2/lab2.iml Normal file
View 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$/Matrix/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

11
lab3/lab3.iml Normal file
View 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$/OperationsStrings/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View 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

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="openjdk-19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/EducationalInstitution.iml" filepath="$PROJECT_DIR$/EducationalInstitution.iml" />
</modules>
</component>
</project>

View 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>

8
lab4/untitled/.idea/.gitignore vendored Normal file
View 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

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="openjdk-19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/untitled.iml" filepath="$PROJECT_DIR$/untitled.iml" />
</modules>
</component>
</project>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,56 @@
import java.util.*;
public class Main {
public static void main(String[] args) {
List<SeaShip> ships = createList();
printList(ships);
ships = sortList(ships);
System.out.println("==============================");
printList(ships);
}
private static ArrayList<SeaShip> createList() {
ArrayList<SeaShip> ships = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < 10; i++)
ships.add(new SeaShip("name" + (i + 1), "class" + (i + 1), "type" + (i + 1),
random.nextInt(10000) + 1000, random.nextDouble() * 100 + 20,
random.nextInt(10000) + 1000, random.nextDouble() * 100));
// ships.add(new SeaShip("nameA", "classA", "typeA",
// random.nextInt(10000) + 1000, 100d,
// random.nextInt(10000) + 1000, 120d));
// ships.add(new SeaShip("nameA", "classA", "typeA",
// random.nextInt(10000) + 1000, 100d,
// random.nextInt(10000) + 1000, 130d));
// ships.add(new SeaShip("nameA", "classA", "typeA",
// random.nextInt(10000) + 1000, 100d,
// random.nextInt(10000) + 1000, 140d));
// ships.add(new SeaShip("nameA", "classA", "typeA",
// random.nextInt(10000) + 1000, 120d,
// random.nextInt(10000) + 1000, 120d));
// ships.add(new SeaShip("nameA", "classA", "typeA",
// random.nextInt(10000) + 1000, 120d,
// random.nextInt(10000) + 1000, 100d));
return ships;
}
private static List<SeaShip> sortList(List<SeaShip> list) {
Comparator<SeaShip> comparator = Comparator.comparing(SeaShip::getLength).reversed()
.thenComparing(SeaShip::getMaxSpeed);
list.sort(comparator);
return list;
}
private static void printList(List<SeaShip> list) {
list.forEach(System.out::println);
}
}

View File

@ -0,0 +1,86 @@
public class SeaShip {
private String name;
private String shipClass;
private String type;
private Integer weight;
private Double length;
private Integer power;
private Double maxSpeed;
public SeaShip(String name, String shipClass, String type,
Integer weight, Double length, Integer power, Double maxSpeed) {
this.name = name;
this.shipClass = shipClass;
this.type = type;
this.weight = weight;
this.length = length;
this.power = power;
this.maxSpeed = maxSpeed;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getShipClass() {
return shipClass;
}
public void setShipClass(String shipClass) {
this.shipClass = shipClass;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getWeight() {
return weight;
}
public void setWeight(Integer weight) {
this.weight = weight;
}
public Double getLength() {
return length;
}
public void setLength(Double length) {
this.length = length;
}
public Integer getPower() {
return power;
}
public void setPower(Integer power) {
this.power = power;
}
public Double getMaxSpeed() {
return maxSpeed;
}
public void setMaxSpeed(Double maxSpeed) {
this.maxSpeed = maxSpeed;
}
@Override
public String toString() {
return "Sea ship '" + name + "', class: " + shipClass + ", type: " + type + ".\n" +
"Weight: " + weight + "\n" +
"Length: " + length + "\n" +
"Engine power: " + power + "\n" +
"Max speed: " + maxSpeed + "\n";
}
}

View 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>