1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
goblinko [34]
3 years ago
7

Monster Collector

Computers and Technology
1 answer:
Lera25 [3.4K]3 years ago
5 0

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

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

If otherwise, prompt the user to keep trying

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

<em>  } </em>

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

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

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

You might be interested in
Is virtualization self monitoring
NISA [10]

Answer:

No

Explanation:

Virtual and physical metrics have to be collected and analysed to look for allocation problems such as: VM sprawl, too many VMs, or improperly provisioned VMs are occurring.

4 0
3 years ago
You have decided to install the DNS server role on Nano Server. What specific type of zone configuration is not supported when u
nadya68 [22]

Answer:Active Directory-integrated

Explanation: Active Directory-integrated is the service that is introduced by the Microsoft .This service provides the directory form for functioning in Windows. It serves the purpose of active directory(AD) transferring to the Dynamic web database. Whenever the user gets connected to any website, it provides validation to qualifications . So, it does not get support the specification when there is working of DNS.

4 0
3 years ago
What are the differences between packet and circuit switching? Which is more prevalent today?
Juliette [100K]

Answer: The difference present between the packet switching and circuit switching are as follows:-

  • Packet switching i the switching in which the data packet travels through the connectionless path whereas connection oriented routes are present for circuit switching
  • Network layer uses the feature of packet switching while physical layer uses circuit switching technique
  • Data transferring is mostly preferred through packet switching and voice communication takes place through the circuit switching.
  • Packet switching is considered flexible as no already established connection is present for switching but the connection in circuit switching are already defined which makes it less flexible.

Among the packet switching and circuit switching , packet switching is preferred for the communication through the data packets because they have  flexibility and affordability.It can establish numerous connection for switching and this make it efficient.

4 0
3 years ago
Two systems are connected by a router. Both systems and the router have transmission rates of 1,000bps. Each link has a propagat
Lisa [10]

Answer:

Two systems are connected by a router. Both systems and the router have transmission rates of 1,000bps. Each link has a propagation delay of 10ms. Also, it takes router 2ms in order to process the packet (e.g. decide where to forward it). Suppose the first system wants to send a 10,000 bit packet to the second system. How long will it take before receiver system receives the entire packet.

Transmission time for first Router = 10,000 bits / 1000 bps = 10 seconds

Receiving time for seond route r= 10,000 bits / 1000 bps = 10 seconds

Propagation delay = 10ms = .01 seconds x 2 for two delays = .02 seconds

First router 2ms to process = .002 seconds

Add all the times together and we get 20.022 seconds which is the same as or 20 seconds and 22 ms

4 0
2 years ago
Computer __ is any part of the computer that can be seen and touched​
iogann1982 [59]
Hardware
Answer. physical parts of computer which can be seen and touched are called Hardware.
3 0
2 years ago
Other questions:
  • HELP PLEASE
    7·2 answers
  • you just finished creating an expense report table, but your boss tells you to create an extra column representing non-productio
    5·1 answer
  • The ____ command creates a subdirectory under a directory. rd md cd ad
    11·1 answer
  • Which of the following devices are least likely to deny a connection inline when an attack is detected? (select 2)
    6·1 answer
  • Whats a hybrid wired network
    9·1 answer
  • Anybody know this question??
    8·1 answer
  • When browsing using certain browsers, if a page is known to be malicious or using phishing techniques in the past a browser may
    5·1 answer
  • Web design and development tools
    13·1 answer
  • 3. Why is human resource plan made​
    11·1 answer
  • How media platform drives globalization.<br> Advantages and disadvantages of using media platforms?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!