esoe 2 years ago
commit
694a338b3a
  1. 21
      book/pom.xml
  2. 5
      book/ru/molokoin/App.java
  3. 21
      country/pom.xml
  4. 53
      country/ru/molokoin/Area.java
  5. 31
      country/ru/molokoin/Country.java
  6. 12
      country/ru/molokoin/Map.java
  7. 35
      pom.xml

21
book/pom.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- parent pom -->
<parent>
<artifactId>education</artifactId>
<groupId>ru.molokoin</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<!-- country info -->
<groupId>ru.molokoin.education</groupId>
<artifactId>book</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
</project>

5
book/ru/molokoin/App.java

@ -0,0 +1,5 @@
package book.ru.molokoin;
public class App {
}

21
country/pom.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- parent pom -->
<parent>
<artifactId>education</artifactId>
<groupId>ru.molokoin</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<!-- country info -->
<groupId>ru.molokoin.education</groupId>
<artifactId>country</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
</project>

53
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;
}
}

31
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()");
}
}

12
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()");
}
}

35
pom.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- parent pom -->
<groupId>ru.molokoin</groupId>
<artifactId>education</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<!-- sub modules -->
<modules>
<module>country</module>
<module>book</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
</plugin>
</plugins>
</build>
</project>
Loading…
Cancel
Save