Question: Write a class called PowerBall that simulates the Power Ball lottery game. The class should have an ArrayList of Integer objects representing the 5 winning
Write a class called PowerBall that simulates the Power Ball lottery game. The class should have an ArrayList of Integer objects representing the 5 winning picks for the white balls numbered 1 to 59 (no duplicates), an integer representing the winning power ball number numbered 1 through 35, and an integer that specifies the jackpot for the game. The class must have the following...
Must user Array List instead of regular arrays to store the numbers, Use a regular for loop to iterate over the array list, and use string builder for the toString method.
Constructors:
public PowerBallGame(){
Generate the winning power ball numbers and the power ball number
}
Methods:
public int getPowerBall() {
returns power ball number
}
public ArrayList
return winning numbers
}
public string toString() { returns to winning power ball numbers back to the users
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
