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

Commit c89b29c

Browse files
committed
Лабораторная №5
1 parent 8865544 commit c89b29c

File tree

7 files changed

+79
-0
lines changed

7 files changed

+79
-0
lines changed

students/23K0202/23K0202-p05/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>23K0202</artifactId>
7+
<groupId>ru.mirea.practice</groupId>
8+
<version>2024.1</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>23K0202-p05</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+
class Circle extends Shape {
4+
public Circle(int x, int y, String color) {
5+
super(x,y,color);
6+
}
7+
8+
public void shape() {
9+
System.out.println("Фигура - круг \nПозиция: х = " + x + " y = " + y + "\nЦвет: " + color + "\n");
10+
}
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package ru.mirea.practice.s0000001;
2+
3+
public abstract class Main {
4+
public static void main(String[] args) {
5+
Circle circle = new Circle(5,5,"Красный");
6+
Square square = new Square(0,-4, "Синий");
7+
Triangle triangle = new Triangle(-7, 10, "Зеленый");
8+
9+
circle.shape();
10+
square.shape();
11+
triangle.shape();
12+
13+
}
14+
}
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+
4+
public abstract class Shape {
5+
protected int x;
6+
protected int y;
7+
protected String color;
8+
9+
public Shape(int x, int y, String color) {
10+
this.x = x;
11+
this.y = y;
12+
this.color = color;
13+
}
14+
15+
public abstract void shape();
16+
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+
class Square extends Shape {
4+
public Square(int x, int y, String color) {
5+
super(x,y,color);
6+
}
7+
8+
public void shape() {
9+
System.out.println("Фигура - квадрат \nПозиция: х = " + x + " y = " + y + "\nЦвет: " + color + "\n");
10+
}
11+
}
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+
class Triangle extends Shape {
4+
public Triangle(int x, int y, String color) {
5+
super(x,y,color);
6+
}
7+
8+
public void shape() {
9+
System.out.println("Фигура - треугольник \nПозиция: х = " + x + " y = " + y + "\nЦвет: " + color + "\n");
10+
}
11+
}

students/23K0202/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
<module>23K0202-p02</module>
1818
<module>23K0202-p03</module>
1919
<module>23K0202-p04</module>
20+
<module>23K0202-p05</module>
2021
</modules>
2122
</project>

0 commit comments

Comments
 (0)