QUESTION

Write a program to implement the old shell game. Randomly pick one of three shells to hold a stone, and ask the user to guess which shell holds the stone. Use the Random class that is covered in this chapter. If the user is correct, they win $1; if they are wrong, they owe $2. Use a loop to run the game 5 times and display the number of wins and losses each time the game is run, and the total dollar value won/lost from the 5 runs. Use dialog boxes for input and output.

Format all dollar amounts as currency. If the user picks an incorrect shell number (i.e., 5, -1), continue to prompt the user for a good value before continuing. Use constants for the win/loss values.

Please submit your java file (.java), the file with the java extension.

Public Answer

BUQ3UO The First Answerer