You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.4 KiB

2 years ago
package country.ru.molokoin;
public class Area {
private String name;
private int population;
private int square;
Area(){}
Area(String name, int population, int square){
2 years ago
init(name, population, square);
}
public void init(String name, int population, int square){
2 years ago
setName(name);
setPopulation(population);
setSquare(square);
}
2 years ago
public void print(){
System.out.println("name: " + name + "; population:" + population + "; square: " + square);
}
2 years ago
/**
* @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;
}
}