Monster Collector
Write this program using an IDE. Comment and style the code according to the CS 200 Style Guide. Submit the source code files (.java) below. Make sure your source files are encoded in UTF-8. Some strange compiler errors are due to the text encoding not being correct.
Monster collector is a game of chance, where the user tries to collect monsters by guessing the correct numbers between 1 and 5. If the user doesn't guess the incorrect number, you catch the monster, otherwise, it gets away!
Example output:
Welcome to Monster Collector, collect 2 monsters to win!
A wild pikamoo appears! Guess a number between 1 and 5
5
You almost had it, but the monster escaped.
A wild bulbaroar appears! Guess a number between 1 and 5
1
Congratulations, you caught bulbaroar!
There are no more monsters to encounter!
You caught i monsters of 2
Keep training to be the very best!
Welcome to Monster Collector, collect 2 monsters to win!
A wild pikamoo appears! Guess a number between 1 and 5
3
Congratulations, you caught pikamoo !
A wild bulbaroar appears! Guess a number between 1 and 5
1
Congratulations, you caught bulbaroar!
There are no more monsters to encounter!
You caught 2 monsters of 2
You're the monster collector master!
A more detailed explanation of the requirements for each method will be in the method header comments - please follow these closely. Suggested order of completion:getMonster(), catchMonster(), printResult() then main(). Config.java contains an array of monsters, and the seed for your random number generator.

Answers

Answer 1

Answer:

In java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int monsternum, usernum;

 int count = 0;

 Random rand = new Random();

 String [] monsters = {"wild pikamoo","wild bulbaroar"};

 for(int i =0;i<2;i++){

     monsternum = rand.nextInt(5);  

     System.out.print("A "+monsters[i]+" appears! Guess a number between 1 and 5: ");

     usernum = input.nextInt();

     if(monsternum == usernum){      count++;      System.out.println("Congratulations, you caught a "+monsters[i]+"!");  }

 else{      System.out.println("You almost had it, but the monster escaped.");  }

 

 }

 System.out.println("There are no more monsters to encounter!");

 System.out.println("You caught "+count+" monsters of 2");

 if(count!=2){      System.out.print("Keep training to be the very best!");  }

 else{      System.out.print("You're the monster collector master!");  }

}

}

Explanation:

This declares monster and user number as integers

 int monsternum, usernum;

Initialize count to 0

 int count = 0;

Call the random object

 Random rand = new Random();

Create a string array to save the monster names

 String [] monsters = {"wild pikamoo","wild bulbaroar"};

Iterate for the 2 monsters

 for(int i =0;i<2;i++){

Generate a monster number

     monsternum = rand.nextInt(5);  

Prompt the user to take a guess

     System.out.print("A "+monsters[i]+" appears! Guess a number between 1 and 5: ");

Get user guess

     usernum = input.nextInt();

If monster number and user guess are equal, congratulate the user and increase count by 1

     if(monsternum == usernum){      count++;      System.out.println("Congratulations, you caught a "+monsters[i]+"!");  }

If otherwise, prompt the user to keep trying

 else{      System.out.println("You almost had it, but the monster escaped.");  }  

 }

Print no monsters again

 System.out.println("There are no more monsters to encounter!");

Print number of monsters caught

 System.out.println("You caught "+count+" monsters of 2");

Print user score

 if(count!=2){      System.out.print("Keep training to be the very best!");  }

 else{      System.out.print("You're the monster collector master!");  }


Related Questions

what are the charactaristic of computer with virus​

Answers

Explanation:

One of the main characteristics of computer viruses is related to the fact that they are programs created by hackers that attack the code of a computer, infecting files on the computer's hard drive or its source code. Once the virus has been copied onto the computer, it can contaminate other computers that come into contact with the machine.

A computer virus is any sort of malware, that when executed, copies its source code and then injects itself into other applications. This process then repeats itself over and over again. What the virus does from here can be many things. The virus can act as a keylogger to steal private information, it could also infect your hard drive and secretly upload your files to a server decided by the creator of the virus.

write a function that returns a list, where each member of list contains previous day’s value multiplied by 2.​

Answers

Answer:

Explanation:

The following code is written in Java, the function takes in a list with the previous day's values. The function then uses that list, loops through it and multiplies each individual value by 2 and returns the modified list. The first red  square represents the test case for the function, while the second red square in the image represents the output.

 public static ArrayList<Integer> doubleIt(ArrayList<Integer> mylist) {

       for (int x = 0; x<mylist.size(); x++) {

           mylist.set(x, mylist.get(x)*2);

       }

       return mylist;

   }

PLS HELP <3 Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar.

var a = 0;

var b = 1;

var c

for(i = 1; I <= 5; i++)

{

C = a +b;

a = b;

b = c;

}

document. write(c);

The output of the document. write statement is ____?

Answers

Answer:

The output of the document. write statement is

Explanation:

Initially: [tex]a = 0[/tex] and [tex]b = 1[/tex]

The iteration is repeated 5 times and the calculation is as follows:

First iteration:

[tex]c = a + b =0 + 1 = 1[/tex]:=> [tex]c = 1[/tex]

[tex]a = b[/tex]:=> [tex]a= 1[/tex]

[tex]b = c[/tex]:=>[tex]b = 1[/tex]

Second iteration:

[tex]c = a + b =1 + 1 = 2[/tex]:=> [tex]c = 2[/tex]

[tex]a = b[/tex]:=> [tex]a= 1[/tex]

[tex]b = c[/tex]:=>[tex]b = 2[/tex]

Third iteration:

[tex]c = a + b =1 + 2= 3[/tex]:=> [tex]c = 3[/tex]

[tex]a = b[/tex]:=> [tex]a= 2[/tex]

[tex]b = c[/tex]:=>[tex]b = 3[/tex]

Fourth iteration:

[tex]c = a + b =2 + 3= 5[/tex]:=> [tex]c = 5[/tex]

[tex]a = b[/tex]:=> [tex]a= 3[/tex]

[tex]b = c[/tex]:=>[tex]b = 5[/tex]

Fifth iteration:

[tex]c = a + b =3 + 5= 8[/tex]:=> [tex]c = 8[/tex]

[tex]a = b[/tex]:=> [tex]a= 5[/tex]

[tex]b = c[/tex]:=>[tex]b = 8[/tex]

End of iteration

document. write(c) prints the value of c which is 8

Suppose users share a 25 Mbps link. Also suppose each user transmits continuously at 5 Mbps when transmitting, and each user transmits only 20 percent of the time. When circuit switching is used, how many users can be supported

Answers

Answer:

Two users have been supported as each user has half of the link bandwidth.

Explanation:

Two users require 1Mbps when transmitting, and fewer users transfer a maximum of 2 Mbps, and the available bandwidth of the shared link is 2 Mbps; there will be no queuing delay before connection. If three users, transmit, then bandwidth will be 3Mbps, and there will be queuing delay before the link. Link size = 2Mpbs, i.e. two users ,transmit, then a maximum of 2Mbps will require and does not exceed 2Mbps of bandwidth.

In the range D5:D9 on all five worksheets, Gilberto wants to project next year's sales for each accessory, rounded up to zero decimal places so the values are easier to remember. In cell D5, enter a formula using the ROUNDUP function that adds the sales for batteries and chargers in 2021 (cell B5) to the sales for the same accessories (cell B5) multiplied by the projected increase percentage (cell C5). Round the result up to 0 decimal places. Fill the range D6:D9 with the formula in cell D5.
I just need the formula!!
A B C D
5
Batteries and chargers $ 123,274.42 1.50% $ 125,124

Answers

Answer:

Enter the following in D5:

=ROUNDUP((SUM(B5,B5)*C5),0)

Explanation:

Required

Add up B5 and B5, then multiply by C5.

Save result rounded up to 0 decimal places in D5

The required computation can be represented as:

D5 = (B5 + B5) * C5 [Approximated to 0 decimal places]

In Excel, the formula is:

=ROUNDUP((SUM(B5,B5)*C5),0)

Analyzing the above formula:

= ---> This begins all excel formulas

ROUNDUP( -> Rounds up the computation

(SUM(B5,B5) ---> Add B5 to B5

*C5) --> Multiply the above sum by C5

,0) ---> The computation is rounded up to 0 decimal places

To get the formula in D6 to D9, simply drag the formula from D5 down to D9.

The resulting formula will be:

=ROUNDUP((SUM(B6,B6)*C6),0)

=ROUNDUP((SUM(B7,B7)*C7),0)

=ROUNDUP((SUM(B8,B8)*C8),0)

=ROUNDUP((SUM(B9,B9)*C9),0)

Answer:

=ROUNDUP((SUM(B5)+(B5)*C5),0)

Explanation:

I followed Mr. Royal's explanation but the numbers just would not match.

I adjusted and used the formula above in cell D5 and I was able to get the correct sum.

Emanuel studies hard for hours on end until bedtime, yet his grades could be better. What can he do to improve his academic performance?

sleep less
take breaks
eat more
work longer

Answers

Emanuel needs to Take breaks

Answer:

Its B! I know I'm late but for the other people that might get the same question like me.

Other Questions
WILL MARK BRAINLIST!! What makes italy famous? What moral values do u think a society should hold rolling two number dice and tossing one coin Which sentence accurately uses the homophones theyre, there, or their?Many of the students left there backpacks on the bus.Theyre going to come home as soon as the movie is over.I think I left the bags of groceries on the floor over their.These dogs bark at everyone, but there not dangerous at all. Give a synonym for the idiom "to call on"The word bogus means fictitious, false. What relationship might there be between this word and the protagonist of Parson's Pleasure? PLEASE HELP ASAP 2 : 6 : 7 = x : 36 : y How could a scientist use a sedimentary rock to provide evidence that the right k cycle is a valid scientific model . To address is to: A. Agree B. Disagree C. Discuss D. Summarize the faulty odemeter of a used car registers 4.6 miles for every 5 miles driven. when travelling from acton to bywater, the faulty odemeter registers 92 miles. how far apart are acton and bywater Which is an example of a wedge?A.BCD What causes matter to change states? a change in the direction of the particles a change in location of the particles a change in size of the particles O a change in the energy of the particles identify the two location for your hands on the steering wheel Simplify a/b + c/fa/b x c/f a/b divided by c/f ,What do all of these symbols stand for? 11. Given that the function graphed is f(x), whatis f(-5)? Helppppppp plsssssssssss What is AC?D5B In an office,2/3 of the telephone bill is paid by Tom,1/5 paid by Azuma and the remaining by Tina. What fraction is paid by Tina? Which body system includes the heart? What is the language of Dubia