ballotpapers.java

来自「一个用JAVA 写的程序」· Java 代码 · 共 105 行

JAVA
105
字号
public class BallotPapers
{
	private Ballot[] ballots;
	private int number;
	private int round = 0;
	private int MAXNUM = 100;

	
	public BallotPapers()
	{
		number = 0;
		ballots = new Ballot[MAXNUM];
	}
	
	public int getNumberOfBallot()
	{
		return number;
	}

	public void add(Ballot aBallot)
	{
		ballots[number] = aBallot;
		number ++;
	}
	
	public Ballot getBallot(int index)
	{
		return ballots[index];
	}

/*	
	public BallotPapers(String id)
	{
		number = 0;
		ballots = new Ballon[MAXNUM];
		BuildPapers(br);
	}
*/	

/*
	public void BuildPapers(BufferedReader br) throws IOException
	{
		  boolean endOfFile = false;
            while (!endOfFile)            
            {
                String line = br.readLine();
                if (line == null)
                    endOfFile = true;
                else
                {
                		StringTokenizer st = new StringTokenizer(line);
		               String id;
		               Ballot ballot = new Ballot();
		               do
		               {
		               	try
			               {
		               		id = st.nextToken();   
                    			ballot.addCandidate(id);
			               }
			               catch(NoSuchElementException e) 
			               {
			               	break;
				            }                    		
				          }
				          ballots.add(ballot);
                }
	}
*/
	

/*	
	public void firstVote()
	{
		int firstVoteNumber;
		Candidate candidate = new Candidate();
		String candidateId;
		int i = 0;
		
		round = 1;
		for(i = 0 ; i< number ; i++)
		{
			candidate = ballots[i].getCandidate(round);
			candidate .addVotesNumber();
		}
	}

	public void otherVotes(int round)
	{
		int otherVotesNumber = 0;
		boolean IsAdd = false;
		String candidateId ;
		int i;
		
		for(i = 0 ; i< number ; i++ )
		{
			Candidate candidate = new Candidate();
			candidate = ballots[i].getCandidate(round - 1);
			if (candidate.isEliminated())
				candidate.addOtherVotesNumber();
		}
		
	}
*/
}

⌨️ 快捷键说明

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