From 694a338b3aafc98b7b72ce7a62ecfa467bbbc688 Mon Sep 17 00:00:00 2001 From: esoe Date: Thu, 13 Oct 2022 15:31:02 +0300 Subject: [PATCH] qq --- book/pom.xml | 21 +++++++++++++ book/ru/molokoin/App.java | 5 +++ country/pom.xml | 21 +++++++++++++ country/ru/molokoin/Area.java | 53 ++++++++++++++++++++++++++++++++ country/ru/molokoin/Country.java | 31 +++++++++++++++++++ country/ru/molokoin/Map.java | 12 ++++++++ pom.xml | 35 +++++++++++++++++++++ 7 files changed, 178 insertions(+) create mode 100644 book/pom.xml create mode 100644 book/ru/molokoin/App.java create mode 100644 country/pom.xml create mode 100644 country/ru/molokoin/Area.java create mode 100644 country/ru/molokoin/Country.java create mode 100644 country/ru/molokoin/Map.java create mode 100644 pom.xml diff --git a/book/pom.xml b/book/pom.xml new file mode 100644 index 0000000..3a3f50f --- /dev/null +++ b/book/pom.xml @@ -0,0 +1,21 @@ + + + + + + education + ru.molokoin + 1.0 + + 4.0.0 + + + ru.molokoin.education + book + 1.0 + jar + + \ No newline at end of file diff --git a/book/ru/molokoin/App.java b/book/ru/molokoin/App.java new file mode 100644 index 0000000..3a3d130 --- /dev/null +++ b/book/ru/molokoin/App.java @@ -0,0 +1,5 @@ +package book.ru.molokoin; + +public class App { + +} diff --git a/country/pom.xml b/country/pom.xml new file mode 100644 index 0000000..6bbcb7c --- /dev/null +++ b/country/pom.xml @@ -0,0 +1,21 @@ + + + + + + education + ru.molokoin + 1.0 + + 4.0.0 + + + ru.molokoin.education + country + 1.0 + jar + + \ No newline at end of file diff --git a/country/ru/molokoin/Area.java b/country/ru/molokoin/Area.java new file mode 100644 index 0000000..3334977 --- /dev/null +++ b/country/ru/molokoin/Area.java @@ -0,0 +1,53 @@ +package country.ru.molokoin; + +public class Area { + private String name; + private int population; + private int square; + + Area(){} + Area(String name, int population, int square){ + setName(name); + setPopulation(population); + setSquare(square); + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + /** + * @param population the population to set + */ + public void setPopulation(int population) { + this.population = population; + } + /** + * @param square the square to set + */ + public void setSquare(int square) { + if (square < 0) throw new IllegalArgumentException("площадь не может быть отрицательной ..."); + this.square = square; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @return the population + */ + public int getPopulation() { + return population; + } + /** + * @return the square + */ + public int getSquare() { + return square; + } +} diff --git a/country/ru/molokoin/Country.java b/country/ru/molokoin/Country.java new file mode 100644 index 0000000..d0a4582 --- /dev/null +++ b/country/ru/molokoin/Country.java @@ -0,0 +1,31 @@ +package country.ru.molokoin; + +public class Country extends Area{ + private Area capital; + + Country(String name, int population, int square, String capitalName, int capitalPopulation, int capitalSquare){ + setCapital(capitalName, capitalPopulation, capitalSquare); + setName(name); + setPopulation(population); + setSquare(square); + } + + /** + * @param сapital the сapital to set + */ + public void setCapital(String name, int population, int square) { + this.capital = new Area(name, population, square); + } + + /** + * @return the сapital + */ + public Area getCapital() { + return capital; + } + + public static void main(String[] args) { + System.out.println("Country.main()"); + + } +} diff --git a/country/ru/molokoin/Map.java b/country/ru/molokoin/Map.java new file mode 100644 index 0000000..3071780 --- /dev/null +++ b/country/ru/molokoin/Map.java @@ -0,0 +1,12 @@ +package country.ru.molokoin; + +public class Map { + private Country[] map;// = new Country[5]; + public void initDefaults(){ + map = new Country[5]; + map[0].setName("Russia"); + } + public static void main(String[] args) { + System.out.println("App.main()"); + } +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3db6df9 --- /dev/null +++ b/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + ru.molokoin + education + pom + 1.0 + + + + country + book + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.0 + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.1 + + + + + \ No newline at end of file