import [Link].
*;
public class MathManiaMarcellaBernard {
public static void main(String[] args) {
String playerName = "";
while (true) {
playerName = [Link](null, "Welcome to MATH Mania!\
n\nEnter your name:", "MATH Mania", JOptionPane.QUESTION_MESSAGE);
if (playerName == null) [Link](0);
if ([Link]().isEmpty()) {
[Link](null, "Name must not be empty.",
"Error", JOptionPane.ERROR_MESSAGE);
} else break;
}
[Link](null,
"Hello, " + playerName + "!\n\n" +
"Welcome to MATH Mania - The Endless Math Challenge!\n\n" +
"Rules:\n" +
"• You have 3 lives. Lose 1 for every wrong answer.\n" +
"• Earn 10 points for every correct answer.\n" +
"• For every 100 points, you get +1 life (max 5).\n" +
"• Rounds are endless until you lose all lives.\n" +
"• Have fun and good luck!",
"Game Rules", JOptionPane.INFORMATION_MESSAGE);
MathManiaSystemMarcellaBernard game = new
MathManiaSystemMarcellaBernard(playerName);
while (true) {
while (![Link]()) {
String message =
"Lives: " + [Link]() + " Points: " +
[Link]() +
"\nRound: " + ([Link]() + 1) +
"\n\nSolve: " + [Link]();
String input = [Link](null, message, "Math
Challenge", JOptionPane.QUESTION_MESSAGE);
if (input == null) {
int confirm = [Link](null, "Do you want
to exit the game?", "Exit", JOptionPane.YES_NO_OPTION);
if (confirm == JOptionPane.YES_OPTION) {
[Link](null, "Thank you for playing
MATH Mania!", "Exit", JOptionPane.INFORMATION_MESSAGE);
[Link](0);
} else continue;
}
String result = [Link](input);
[Link](null, result, "Result",
JOptionPane.INFORMATION_MESSAGE);
}
// Game Over
[Link](null,
"You are out of lives!\n\n" + [Link](),
"Game Over", JOptionPane.INFORMATION_MESSAGE);
int retry = [Link](null,
"Would you like to play again, " + playerName + "?",
"Try Again?", JOptionPane.YES_NO_OPTION);
if (retry == JOptionPane.YES_OPTION) {
game = new MathManiaSystemMarcellaBernard(playerName); // Restart
} else {
[Link](null, "Thanks for playing MATH
Mania!\nSee you next time!", "Exit", JOptionPane.INFORMATION_MESSAGE);
[Link](0);
}
}
}
}