用JAVA语言编写一个种树的项目

public class Tree {

用JAVA语言编写一个种树的项目

private int treeId;

private String treeType;// 树种类型

private int count; //种植数量

public int getCount() {

return count;

}

public void setCount(int count) {

this.count = count;

}

public int getTreeId() {

return treeId;

}

public void setTreeId(int treeId) {

this.treeId = treeId;

}

public String getTreeType() {

return treeType;

}

public void setTreeType(String treeType) {

this.treeType = treeType;

}

}

public class Address {

private int addCode;//地区编码

用JAVA语言编写一个种树的项目

private String area;//地名

public int getAddCode() {

return addCode;

}

public void setAddCode(int addCode) {

this.addCode = addCode;

}

public String getArea() {

return area;

}

public void setArea(String area) {

this.area = area;

}

}

import java.util.HashMap;

import java.util.Map;

public class People {

private int userId;

private String username;

private Map<String,Map<String,Integer>> map;

/**

* 传入地区和树种,种树成功。保存到map中。

* @param address

* @param tree

用JAVA语言编写一个种树的项目

*/

public void plantingTrees(String address,Tree tree){

Map map = new HashMap();

map.put(tree.getTreeType(),tree.getCount());

this.map.put(address,map);

}

public int getUserId() {

return userId;

}

public void setUserId(int userId) {

this.userId = userId;

}

public String getUsername() {

return username;

}

public void setUsername(String username) {

this.username = username;

}

public Map<String, Map<String, Integer>> getMap() {

return map;

}

public void setMap(Map<String, Map<String, Integer>> map) {

this.map = map;

}

}

相关推荐

返回顶部