This repository was archived by the owner on Dec 28, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +79
-0
lines changed
src/main/java/ru/mirea/practice/s0000001 Expand file tree Collapse file tree 7 files changed +79
-0
lines changed Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 17
17
<module >23K0202-p02</module >
18
18
<module >23K0202-p03</module >
19
19
<module >23K0202-p04</module >
20
+ <module >23K0202-p05</module >
20
21
</modules >
21
22
</project >
You can’t perform that action at this time.
0 commit comments