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日
最近浏览更多
阿猫喵喵喵996  LV12 1月25日
1WQAQW1  LV2 2023年6月12日
crosa_Don  LV18 2022年7月6日
最代码-宋家辉  LV61 2021年6月14日
itcaizhe  LV9 2021年6月10日
Killah  LV9 2021年4月16日
2469095052  LV8 2021年3月3日
1771658781  LV5 2021年1月3日
dongzhan  LV12 2020年12月22日
186啊哈  LV2 2020年12月10日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友