-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbingoTwoRefectored.java
More file actions
24 lines (18 loc) · 937 Bytes
/
bingoTwoRefectored.java
File metadata and controls
24 lines (18 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Bingo ( Or Not )
// DESCRIPTION:
// For this game of BINGO, you will receive a single array of 10 numbers from 1 to 26 as an input. Duplicate numbers within the array are possible.
// Each number corresponds to their alphabetical order letter (e.g. 1 = A. 2 = B, etc). Write a function where you will win the game if your numbers can spell "BINGO". They do not need to be in the right order in the input array. Otherwise you will lose. Your outputs should be "WIN" or "LOSE" respectively.
import java.util.*;
public class BingoOrNot {
public static String bingo(int[] numberArray){
ArrayList<Integer> list = new ArrayList<>();
for(int i = 0; i < numberArray.length; i++){
list.add(numberArray[i]);
}
if(list.contains(2) && list.contains(9) && list.contains(14) && list.contains(7) && list.contains(15)){
return "WIN";
}else {
return "LOSE";
}
}
}