diff --git a/students/23K1302/23K1302-p18/pom.xml b/students/23K1302/23K1302-p18/pom.xml index 676416c3..cfad2427 100644 --- a/students/23K1302/23K1302-p18/pom.xml +++ b/students/23K1302/23K1302-p18/pom.xml @@ -10,16 +10,4 @@ 23K1302-p18 Задание 18 - - - - org.apache.maven.plugins - maven-compiler-plugin - - 14 - 14 - - - - diff --git a/students/23K1302/23K1302-p19/pom.xml b/students/23K1302/23K1302-p19/pom.xml new file mode 100644 index 00000000..caebc5a2 --- /dev/null +++ b/students/23K1302/23K1302-p19/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + + 23K1302 + ru.mirea.practice + 2024.1 + ../pom.xml + + 23K1302-p19 + Задание 19 + diff --git a/students/23K1302/23K1302-p19/src/main/java/ru/mirea/practice/s0000001/Ex1.java b/students/23K1302/23K1302-p19/src/main/java/ru/mirea/practice/s0000001/Ex1.java new file mode 100644 index 00000000..d2a7fece --- /dev/null +++ b/students/23K1302/23K1302-p19/src/main/java/ru/mirea/practice/s0000001/Ex1.java @@ -0,0 +1,25 @@ +package ru.mirea.practice.s0000001; + +public final class Ex1 { + + private Ex1() { + // NONE + } + + public static void main(String[] args) { + try { + String inn = "12345967890"; + + validateInn(inn); + System.out.println("Заказ успешно оформлен!"); + } catch (InvalidInnException e) { + System.out.println("Ошибка: " + e.getMessage()); + } + } + + public static void validateInn(String inn) throws InvalidInnException { + if (inn.length() != 10) { + throw new InvalidInnException("Недействительный ИНН: " + inn); + } + } +} diff --git a/students/23K1302/23K1302-p19/src/main/java/ru/mirea/practice/s0000001/InvalidInnException.java b/students/23K1302/23K1302-p19/src/main/java/ru/mirea/practice/s0000001/InvalidInnException.java new file mode 100644 index 00000000..fd7fdf72 --- /dev/null +++ b/students/23K1302/23K1302-p19/src/main/java/ru/mirea/practice/s0000001/InvalidInnException.java @@ -0,0 +1,7 @@ +package ru.mirea.practice.s0000001; + +public class InvalidInnException extends Exception { + public InvalidInnException(String message) { + super(message); + } +} diff --git a/students/23K1302/pom.xml b/students/23K1302/pom.xml index 26c8b7d3..32924562 100644 --- a/students/23K1302/pom.xml +++ b/students/23K1302/pom.xml @@ -32,5 +32,6 @@ 23K1302-p16 23K1302-p17 23K1302-p18 + 23K1302-p19