⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 balancesheet.java

📁 一个java写的大富翁游戏
💻 JAVA
字号:
/*
 * Created on 2004/7/24
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package rich;
import java.util.ArrayList;
/**
 * @author ZhiJian
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class BalanceSheet {
	
	int cashInHand;
	int cashInBank;
	ArrayList groundList ;
	
	
	BalanceSheet(int cashInHand,int cashInBank){  // initial all information
		this.cashInBank = cashInBank;
		this.cashInHand = cashInHand;
		groundList = new ArrayList();
	}
	
	void setCashInHand(int cash,String type){  //store or pay money
		if(type=="store"){
			cashInHand += cash;
		}else if(type=="pay"){
			cashInHand-=cash;
		}
	}
	
	int getCashInHand(){ return cashInHand; }
	
	void setCashInBank(int cash,String type){  //save or carry in bank
		if(type=="store"){
			cashInBank += cash;
		}else if(type=="pay"){
			cashInBank -= cash;
		}
	}

	int getCashInBank(){return cashInBank;}	 
	
	boolean setGround(Ground ground,Character Owner){	//buy ground
		if(ground.getOwner()==null){
			ground.setOwner(Owner);
			groundList.add(ground);
			return true;
			
		}else{
			return false;
		}

	}
	
	ArrayList getGround(){ return groundList; }

	void updateBuilding(int address){	//update building
		
		Ground ground;
		int i=0;
		do{
			ground = (Ground)groundList.get(i);
			i++;
		}while(ground.getAddress()!=address);
		ground.levelUp();
		cashInHand -= 500;
		
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -