Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

Commit 321e99f

Browse files
authored
Merge pull request #323 from zula4z/features/lab#6-10
Лабораторные №№6-10
2 parents 1031533 + 6475488 commit 321e99f

File tree

25 files changed

+697
-0
lines changed

25 files changed

+697
-0
lines changed

students/23K0340/23K0340-p06/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>23K0340</artifactId>
7+
<groupId>ru.mirea.practice</groupId>
8+
<version>2024.1</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>23K0340-p06</artifactId>
12+
<description>Массивы</description>
13+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package ru.mirea.practice.s0000001;
2+
3+
public interface Convertable {
4+
5+
void convert(double temp);
6+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package ru.mirea.practice.s0000001;
2+
3+
public class Farengate implements Convertable {
4+
private double temp;
5+
6+
public Farengate(double tempF) {
7+
this.temp = tempF;
8+
}
9+
10+
public double getTemp() {
11+
return temp;
12+
}
13+
14+
@Override
15+
public void convert(double temp) {
16+
this.temp = temp * 1.8 + 32;
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package ru.mirea.practice.s0000001;
2+
3+
public class Kelvin implements Convertable {
4+
private double tempK;
5+
6+
public Kelvin(double temp) {
7+
this.tempK = temp;
8+
}
9+
10+
public double getTempK() {
11+
return tempK;
12+
}
13+
14+
@Override
15+
public void convert(double temp) {
16+
this.tempK = temp + 273;
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package ru.mirea.practice.s0000001;
2+
3+
public interface Movable {
4+
void moveUp();
5+
6+
void moveDown();
7+
8+
void moveLeft();
9+
10+
void moveRight();
11+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package ru.mirea.practice.s0000001;
2+
3+
public class MovableCircle extends MovablePoint implements Movable {
4+
private int radius;
5+
private MovablePoint center;
6+
7+
public MovableCircle(int x, int y, int xspeed, int yspeed, int radius) {
8+
super(x, y, xspeed, yspeed);
9+
this.center = new MovablePoint(x,y,xspeed,yspeed);
10+
this.radius = radius;
11+
}
12+
13+
public String toString() {
14+
return "MovacleCircle{center:" + center.toString() + ", radius:" + radius;
15+
}
16+
17+
@Override
18+
public void moveUp() {
19+
super.moveUp();
20+
this.center.moveUp();
21+
}
22+
23+
@Override
24+
public void moveDown() {
25+
super.moveDown();
26+
this.center.moveDown();
27+
}
28+
29+
@Override
30+
public void moveRight() {
31+
super.moveRight();
32+
this.center.moveRight();
33+
}
34+
35+
@Override
36+
public void moveLeft() {
37+
super.moveLeft();
38+
this.center.moveLeft();
39+
}
40+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package ru.mirea.practice.s0000001;
2+
3+
public class MovablePoint implements Movable {
4+
protected int x;
5+
protected int y;
6+
protected int xspeed;
7+
protected int yspeed;
8+
9+
public MovablePoint(int x, int y, int xspeed, int yspeed) {
10+
this.x = x;
11+
this.y = y;
12+
this.xspeed = xspeed;
13+
this.yspeed = yspeed;
14+
}
15+
16+
public String toString() {
17+
return "MovablePoint{x:" + x + ", y:" + y + ", xspeed:" + xspeed + ", yspeed" + yspeed + "}";
18+
}
19+
20+
@Override
21+
public void moveUp() {
22+
this.y += yspeed;
23+
}
24+
25+
@Override
26+
public void moveDown() {
27+
this.y -= yspeed;
28+
}
29+
30+
@Override
31+
public void moveLeft() {
32+
this.x += xspeed;
33+
}
34+
35+
@Override
36+
public void moveRight() {
37+
this.x -= xspeed;
38+
}
39+
}

students/23K0340/23K0340-p07/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>23K0340</artifactId>
7+
<groupId>ru.mirea.practice</groupId>
8+
<version>2024.1</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>23K0340-p07</artifactId>
12+
<description>Массивы</description>
13+
</project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package ru.mirea.practice.s0000001;
2+
3+
public interface Movable {
4+
void moveUp();
5+
6+
void moveDown();
7+
8+
void moveLeft();
9+
10+
void moveRight();
11+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package ru.mirea.practice.s0000001;
2+
3+
public class MovablePoint implements Movable {
4+
private int x;
5+
private int y;
6+
private int speedX;
7+
private int speedY;
8+
9+
public MovablePoint(int x, int y, int speedX, int speedY) {
10+
this.x = x;
11+
this.y = y;
12+
this.speedX = speedX;
13+
this.speedY = speedY;
14+
}
15+
16+
public int getSpeedX() {
17+
return speedX;
18+
}
19+
20+
public int getSpeedY() {
21+
return speedY;
22+
}
23+
24+
public void setX(int x) {
25+
this.x = x;
26+
}
27+
28+
public void setY(int y) {
29+
this.y = y;
30+
}
31+
32+
@Override
33+
public void moveUp() {
34+
this.y += speedY;
35+
}
36+
37+
@Override
38+
public void moveDown() {
39+
this.y -= speedY;
40+
}
41+
42+
@Override
43+
public void moveLeft() {
44+
this.x -= speedX;
45+
}
46+
47+
@Override
48+
public void moveRight() {
49+
this.x += speedX;
50+
}
51+
}

0 commit comments

Comments
 (0)