Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is for Java programming. The program must be written in Java In this simple Role-playing game, you play as a fisherman whose job is

This is for Java programming. The program must be written in Java

In this simple Role-playing game, you play as a fisherman whose job is to catch enough fish everyday to feed their crew.

If all else fails, there is always the loan shark. The loan shark can help meet the daily quota if the player falls short, but the penalty for not paying them back ends the game.

The game has two basic modes of play:

- Mode one allows the player to play in arcade mode (more details below), to achieve as many days as possible

- Mode two allows the player to play in story mode (mode details below), to achieve the task of feeding the crew for a fixed number of days (or turns) The game ends if the player is not able to meet the daily quota of fish needed for the crew, or if the loan term with loan shark runs out.

Gameplay

The following criteria outlines the gameplay specifications your program will need to meet:

When the game begins the system will read the file called tools.txt. This file contains a list of possible tools that the player is able to use to catch fish each day. The file contains the following details:

- Tool name - a description of the weapon

- Strong against - the tool is strong against the fish being caught, leading to doubling the number of fish caught

- Weak against - the tool is weak against the fish being caught, leading to halving the number of fish caught

- Cost - the number of fish it costs to use the tool

- Min Fish - the minimum number of fish that can be caught

- Max Fish - the maximum number of fish that can be caught

There are four main types of fish which can be caught. They are as follows:

- Tuna

- Salmon

- Sardine

- Herring

When the game starts, the player enters their name, which must be between 3 and 12 characters long (both inclusive). If this criterion is not met, the player is asked to re-enter their name until correct.

The player is then asked to select which mode they would like to play in:

- Arcade: the game goes on until the player is not able to get enough fish required for the end of the day. Highest number of days is written to the file at the end of the game.

- Story mode: the player is asked to enter the number of turns they would like to play. This must be greater than or equal to 5. The player is also asked to enter a target number of the fish balance remaining after the turns. The number entered must be greater than or equal to 25. Any incorrect information must prompt the user to re-enter. The program must also validate this information.

- In both play modes: The player begins the game with 10 fish. The game then randomly generates a number between 10-20. This number indicates the number of fish the crew needs for today in order to survive. The game then also randomly generates a second number between 1-10. The game will also present the player with a 1% probability of a natural disaster happening. This will cause a random penalty of between 50 and 100 fish. The player is presented with a menu as follows: 1: catch fish 2: borrow from the loan shark 3: Skip Based on this information, the player then selects one of the options above to perform the action (these are detailed below) The player can fish a maximum of 2 times in one turn.

Catching fish:

The player is asked to select their tool of choice from the list read from the file. Each tool costs fish. The program will then randomly select a type of fish which the player will attempt to use the tool to catch. For the selected tool, the game randomly generates a number between the min fish and max fish values read from the file. This will indicate the number of fish caught. If the tool selected is strong against the fish being hunted, the number of fish caught is doubled. However, if the tool selected is weak against the fish being hunted, the number of fish caught is halved.

Borrowing from the loan shark

Should the player not be able to catch enough fish to reach the daily quota, they can choose to borrow fish from the loan shark. When borrowing from the loan shark, the player is prompted to enter the number of fish that needs to be borrowed. This is added to the player's total number of fish. The loan shark only gives the player 3 turns to pay back 1.5 times the number of fish borrowed. The maximum number of fish which can be borrowed at any one time is 30. Once the loan reaches 100 fish, no more fish can be borrowed. After the three turns have passed, or if the number of turns lapses in story mode, the balance is deducted from the total number of fish the player has.

Skipping a turn

Should the player feel that the number of fish caught the previous day is more than enough to feed the crew today, The player can simply skip fishing that day only. This option simply deducts the number of fish required for the day from the total number of fish the player has.

The game ends when:

- Arcade mode The number of fish available at the end of the day is negative after performing all required actions.

- Story mode The required number of turns entered by the user has passed. The player wins if the number of fish available after the turns is close to the target number of the fish balance (within +/- 10%.), the target number set by the player at the beginning of the game.

Upon completing the game, the program will write the results to the file as follows:

- Arcade mode The type of game played, the player name, and the total number of days the crew was fed

- Story mode The type of game played, the player name, the number of turns, the target number of fish balance, the final number of fish after all the turns complete, and the win or loss condition.

tools.txt

Fishing Rod,Sardine,Tuna,2,3,7 Harpoon,Tuna,Sardine,4,7,11 Spear Gun,Salmon,Herring,7,11,15 Net,Herring,Salmon,10,15,19

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Law Text and Cases

Authors: Kenneth W. Clarkson, Roger LeRoy Miller, Gaylord A. Jentz, F

11th Edition

324655223, 978-0324655223

More Books

Students also viewed these Programming questions

Question

Quadrilateral EFGH is a kite. Find mG. E H Answered: 1 week ago

Answered: 1 week ago