esoe 2 years ago
parent
commit
dc7f23d7df
  1. 4
      country/ru/molokoin/Area.java
  2. 11
      country/ru/molokoin/Country.java

4
country/ru/molokoin/Area.java

@ -7,6 +7,10 @@ public class Area {
Area(){} Area(){}
Area(String name, int population, int square){ Area(String name, int population, int square){
init(name, population, square);
}
public void init(String name, int population, int square){
setName(name); setName(name);
setPopulation(population); setPopulation(population);
setSquare(square); setSquare(square);

11
country/ru/molokoin/Country.java

@ -4,15 +4,22 @@ public class Country extends Area{
private Area capital; private Area capital;
Country(String name, int population, int square, String capitalName, int capitalPopulation, int capitalSquare){ Country(String name, int population, int square, String capitalName, int capitalPopulation, int capitalSquare){
init(name, population, square, capitalName, capitalPopulation, capitalSquare); this.init(name, population, square);
this.capital = new Area();
getCapital().init(capitalName, capitalPopulation, capitalSquare);
} }
public Country() { public Country() {
} }
public void init(String name, int population, int square, String capitalName, int capitalPopulation, int capitalSquare){ public void init(String name, int population, int square, String capitalName, int capitalPopulation, int capitalSquare){
setCapital(capitalName, capitalPopulation, capitalSquare);
/**
* setCapital(capitalName, capitalPopulation, capitalSquare);
setName(name); setName(name);
setPopulation(population); setPopulation(population);
setSquare(square); setSquare(square);
*/
} }

Loading…
Cancel
Save