1700466996
1700466997
private int cost=0;
1700466998
1700466999
public Project(){
1700467000
1700467001
}
1700467002
1700467003
//定义一个构造函数,把所有老板需要看到的信息存储起来
1700467004
1700467005
private Project(String name,int num,int cost){
1700467006
1700467007
//赋值到类的成员变量中
1700467008
1700467009
this.name=name;
1700467010
1700467011
this.num=num;
1700467012
1700467013
this.cost=cost;
1700467014
1700467015
}
1700467016
1700467017
//增加项目
1700467018
1700467019
public void add(String name,int num,int cost){
1700467020
1700467021
this.projectList.add(new Project(name,num,cost));
1700467022
1700467023
}
1700467024
1700467025
//得到项目的信息
1700467026
1700467027
public String getProjectInfo(){
1700467028
1700467029
String info=””;
1700467030
1700467031
//获得项目的名称
1700467032
1700467033
info=info+“项目名称是:”+this.name;
1700467034
1700467035
//获得项目人数
1700467036
1700467037
info=info+”\t项目人数:”+this.num;
1700467038
1700467039
//项目费用
1700467040
1700467041
info=info+”\t项目费用:”+this.cost;
1700467042
1700467043
return info;
1700467044
1700467045
}
[
上一页 ]
[ :1.700466996e+09 ]
[
下一页 ]