subject

For this lab you will write a Java program that will run a Dragon Trainers. The rules of the game are simple: each player has three dragons that they have trained, and each dragon is tied to a particular element. Each player has a Fire Dragon, a Water Dragon and a Plant Dragon. Each player picks one dragon to put out in front of them to fight the other player's dragon. Both players choose separately without knowing what the other player has selected. Fire Dragons always beat Plant Dragons, Plant Dragons always beat Water Dragons, and Water Dragons always beat Fire Dragons. If both players choose the same kind of dragon, they tie. Your program will run a series of games of one player against the computer. First the player will be prompted for a random seed and then a number of matches to play. For each match, the computer will pick a random dragon type and the player will enter their choice as a single letter- F for fire, W for water, or 'P' for plant (the program should accept either uppercase or lowercase, and should only care about the first letter of the user's input). The program should then report both choices as well as who the winner is. This process repeats until all of the matches have been played- at that point the program will reporta summary of the matches and decide who won the tournament overall. See the transcripts below for how your output should be formatted.
NOTE if the player enters an invalid choice, the computer wins by default.
NOTE To generate a random choice, you must use the Random object as we have used in the previous labs. You can use it to generate a number between 0 and 2 and assiign each value to a type of dragon A value of 0 will be Fire, 1 will be Plant and 2 will be Water. Note that you MUST use these assignments of numbers to types for your submission to be able to pass the test cases!
NOTE You MUST only declare and instantiate one single Random object to be able to match the test cases And this must be done outside of your main game loop. Note that this is typically how Random objects are used-you create them once and then use the same Random object for your entire program, rather than creating new ones every time you need a new random number.
Here is one example of the game in action. Note that as always, user inputs are in BOLD.
Enter a random seed: 24
How many matches will we play? 3
Please select one of your dragons [Fire/Plant/Water]: Plant
You chose: Plant dragon.
I chose: Plant dragon.
A Tie!
Please select one of your dragons [Fire/Plant/Water]: FIRE
You chose: Fire dragon.
I chose: Plant dragon.
Fire defeats Plant -you win!
Please select one of your dragons [Fire/Plant/Water]: w
You chose: Water dragon.
I chose: Fire dragon.
Water defeats Fire you win!
The tournamont is over!
We tied 1 matches.
I won 0 matches.
You won 2 matches.
You are the winner!
Here is another example of the game in action. Note that if the user enters an invalid response, the computer wins by default. But also note that only the first character of the input matters when determining whether or not the input is valid
Enter a random seed: 33
How many matches will we play? 4
Please select one of your dragona (Fire/Plant/Water]:
You chose: Fire dragon.
I chose: Fire dragon.
A Tie!
Please select one of your dragons [Fire/Plant/Water): pfjlsd
You chose: Plant dragon.
I chose: Fire dragon.
Fire defeats Plant-you lose!
Please select one of your dragons [Fire/Plant/Water]: jkfld
You don't have a jkfld dragon, so you choose no dragons.
I chose: Water dragon.
I win by default!
Please nelect one of your dragons [Fire/Plant/Water]: plnat
You chose: Plant dragon.
I chose: Water dragon.
Plant defeats Water -you win!
Please select one of your dragons [Fire/Plant/Water] plnat
You chose: Plant dragon.
I chose: Water dragon.
Plant defeats Water- you win!
The tournament is over!
We tied 1 matches.
I Won 2 matches.
You won 1 matoches.
I am the winner!
If there is a tie, the final message should indicate that neither player is the winner as in the transcript below
Enter a random seed: 33
How many matches will we play? 1
Please select one of your dragons [Fire/Plant/Water]: Fire
You chose: Fire dragon. Fire dragon.
I chose:
A Tie!
The tournament is over!
We tied 1 matches.
I won 0 matches.
You won 0 matches.
Neither of us can claim victory here!

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:30
Write the html code to make a link out of the text “all about puppies”. it should link to a pdf called “puppies.pdf” inside the “documents” folder. the pdf should open in a new window.
Answers: 2
question
Computers and Technology, 23.06.2019 03:50
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
What is html ? give a small description about html
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 1
You know the right answer?
For this lab you will write a Java program that will run a Dragon Trainers. The rules of the game ar...
Questions
question
History, 04.11.2019 03:31
question
Mathematics, 04.11.2019 03:31
question
History, 04.11.2019 03:31
question
Mathematics, 04.11.2019 03:31
question
History, 04.11.2019 03:31
Questions on the website: 13722363