} //end Win1 public int isWin2(LotteryTicket lt) { if (!(lt.powerBall == winTicket[5])) //powerball { return(0); //not a winning ticket } int[] iBallsMatch = { 0, 0, 0, 0, 0 }; //flag array. Set to 1 if Match! for (int i = 0; i < 5; i++) { iBallsMatch[i] = 0; //0 if lost, 1 if winner for (int j = 0; j < 5; j++) { if (lt.balls[i] == winTicket[j]) { iBallsMatch[i] = 1; //this ticket is OK } } //end for } if (iBallsMatch[0] + iBallsMatch[1] + iBallsMatch[2] + iBallsMatch[3] + iBallsMatch[4] == 4) { return(1); //Winner } else { return(0); //not a winner } }
public int isWin8(LotteryTicket lt) { if (lt.powerBall == winTicket[5]) //powerball { return(1); //Winner } else { return(0); //not a winner } }