Question: Lab3.1 Fishing Game [60pts]: Write a Java program that simulates a fishing game. In this game, a six-sided die is rolled to determine what the

 Lab3.1 Fishing Game [60pts]: Write a Java program that simulates a

fishing game. In this game, a six-sided die is rolled to determine

Lab3.1 Fishing Game [60pts]: Write a Java program that simulates a fishing game. In this game, a six-sided die is rolled to determine what the user has caught. Each possible item is worth a certain number of fishing points. The points will remain hidden until the user is finished fishing, and then a message is displayed congratulating the user, depending on the number of fishing points gained. Develop your program to implement the following design details: (1) The program simulates the rolling of a six-sided die (use the Die class that defined in Die.java file, attached in the "Lab-3(Week-5)" Assignment drop box.). (2) Each item that can be caught is represented by a number generated from the die (1 to 6); for example, 1 for "a huge fish", get 100 points, 2 for an old shoe", get 0 point, 3 for a little fish", get 10 points, and so on. (You may design your own scheme for this fun part). (3) Each round of the game is performed as an iteration of a loop that repeats as long as the player wants to fish for more times. So, at the beginning of each round, the program will ask the user whether or not he or she wants to continue fishing. (4) The loop keeps a running total of the user's fishing points, and count number of 1's, number of 2's and number of 3's and so on. (5) After the loop has finished the total number of fishing points is displayed along with a message that shows how many "huge fish" (i.e. how many 1's), how many "old shoes (.e. how many 2's), or how many "little fish" (i.e., how many 3's), and so on. (6) Save your source code as "FishingGame.java". Compile and test your program to make sure there is no syntax logical, or run-time error. import java.util. Random; /** The Die class simulates a six-sided die. public class Die { private int sides; private int value; // Number of sides // The die's value The constructor performs an initial roll of the die. The number of sides for the die is passed as an argument. @param numSides The number of sides for the die. public Die(int numSides) { sides = numSides; roll(); } /** The roll method simlates the rolling of the die public void rollo { // Create a Random object. Random rand = new Random(); // Get a random value for the die. value = rand.nextInt (sides) + 1; } /** The getSides method returns the number of sides for the die. @return The number of sides for the die. public int getSides() { return sides; } /** The getValue method returns the value of the die. @return the value of the die. public int getValue() { return value; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!