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, 22.06.2019 01:00
Ap practice - performance task response the ap create performance task asks you to write about an abstraction that you developed and wrote into your code. most of the time that means identifying a function or procedure you wrote to "manage complexity" in your program. here is the actual prompt from the create performance task: 2d. capture and paste a program code segment that contains an abstraction you developed individually on your own (marked with a rectangle). this abstraction must integrate mathematical and logical concepts. explain how your abstraction manage the complexity of your program. (must not exceed 200 words) below is a segment of code from an "under the sea" program with a rectangle drawn around a portion of the code identifying an abstraction. imagine that you wrote this and are composing an ap response about how this abstraction manages complexity. (note: ignore the requirement that the abstraction integrate "mathematical and logical concepts" for this practice response. just write about managing complexity). explain how the abstraction marked with the rectangle in the code above manage complexity of this program. write your response here submit
Answers: 2
question
Computers and Technology, 22.06.2019 13:30
Asoftware company hired ray, a college graduate to work in their development team. ray is assigned to work in the coding phase of a project. what happens during the coding phase of a software development project? a. the customer receives a working model of the software. b. developers convert the program design into code. c. developers gather requirements directly from the stakeholders. d. testing teams check the product for quality.
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Researchers measured the data speeds for a particular smartphone carrier at 50 airports. the highest speed measured was 78.1 mbps. the complete list of 50 data speeds has a mean of x overbarequals16.11 mbps and a standard deviation of sequals18.65 mbps. a. what is the difference between carrier's highest data speed and the mean of all 50 data speeds? b. how many standard deviations is that [the difference found in part (a)]? c. convert the carrier's highest data speed to a z score. d. if we consider data speeds that convert to z scores between minus2 and 2 to be neither significantly low nor significantly high, is the carrier's highest data speed significant? a. the difference is nothing mbps.
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
The basic work area of the computer is it screen that you when you first fire up your computer
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
Mathematics, 24.03.2020 19:58