Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. Create a Mine Field game in which the user attempts to click 10 panels of a g

ID: 3669001 • Letter: A

Question

a. Create a Mine Field game in which the user attempts to click 10 panels of a grid before hitting the "bomb". Set up a JFrame using BorderLayout, use the NORTH region for a congratulatory message, and use the CENTER region for the game. In the CENTER region, create a four-by-five grid using GridLayout and populate the grid with JPanels. Set the background color for all the JPanels to Color.BLUE. Randomly choose one of the panels to be the bomb; the other 19 panels are "safe". Allow the player to click on the grids. If the player chooses a safe panel, turn the panel to Color.RED and turn all of the remaining panels to white. If the user successfully chooses 10 safe panels before choosing the bomb, display a congratulatory message in the NORTH JFrame region. Save the game as MineField.java.

b. Improve the Mine Field game by allowing the user to chose a difficulty level before beginning. Place three buttons labeled "Easy", "Intermediate", and "Difficult" in one region of the JFrame, and place the game grid and congratulatory message in other regions. Require the user to select a difficulty level before starting the game, and then disable the buttons. If the user chooses "Easy", the user must select only five safe panels to win the game. If the user selects "Intermediate", require 10 safe panels, as in the original game. If the user selects "Difficult", require 15 safe panels. Save the game as MineField2.java.

Explanation / Answer

MineField2.java

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote