package com.ttd.test;
public class Money {
protected int amount;
protected String currency;
/* static Dollar dollar(int amount,String currency){
return new Dollar(amount,currency);
}
static Franc franc(int amount,String currency){
return new Franc(amount,currency);
}*/
static Money dollar(int amount,String currency){
return new Money(amount,currency);
}
static Money franc(int amount,String currency){
return new Money(amount,currency);
}
Money(int amount,String currency) {
this.amount = amount;
this.currency = currency;
}
public boolean equals(Object object){
Money money = (Money)object;
/*return this.amount==money.amount
&& this.getClass().equals(money.getClass());*/
return this.amount==money.amount
&& currency().equals(money.currency());
}
Money times(int multiplier){
return new Money(amount*multiplier,this.currency);
}
String currency(){
return currency;
}
@Override
public String toString() {
return amount+" "+currency;
}
}
最近下载更多
数据库1 LV12
2020年7月7日
1279894731 LV1
2019年11月13日
yongzheng132 LV17
2019年6月25日
kld113 LV20
2019年3月5日
fengbinzj LV1
2019年1月25日
rangnixiao LV21
2018年10月20日
Sean_yang LV1
2018年4月10日
javalang LV1
2018年3月20日
1755790963 LV1
2017年9月8日
sc936866 LV11
2017年8月16日

最近浏览