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
A tripod head can move vertically or horizontally. What term describes these movements?
AnnyKZ [126]

The term for vertical movement of a tripod is Tilt. The term for horizontal movement is Pan.

Vertical movement of the camera angle involves pointing the camera up and down. This sort of movement is achieved so as to follow a subject or show the top and bottom of a still object. With Tilt, you can show how tall objects are. On the other hand, the tripod’s horizontal movement is used for a smooth effect. Like Tilting, it shows a subject or show the distance from left to right between two objects. Pan shots are great for panoramic views .

7 0
4 years ago
Read 2 more answers
Read the following code:
sergejj [24]

Answer:

0

1

2

3

4

5

Explanation:

The loop first prints when n is still 0, so 0 is in the list.

The loop still executes when n = 5, so 5 must also be in the list.

6 0
3 years ago
Advantage of social media for today'​
Lyrx [107]

Answer:

This social media advantage helps your business in numerous ways: You get to know them better: When you know your audience better, you can deliver more valuable content to them. ... You provide better customer service: A direct connection with your audience allows you to resolve issues easier

Explanation:

(happy to help)

6 0
3 years ago
When heading styles have been applied to a document, the user has the option to navigate through the document using which tab on
trasher [3.6K]

Answer: To navigate through the document

Explanation:

4 0
3 years ago
What's the difference between a game of skill and game of chance?
Hunter-Best [27]
If its a game of skill, the game depends on how good you are in gaming, if its a game of chance it depends on what are the chances of you winning
5 0
3 years ago
Other questions:
  • A client is concerned that a power outage or disaster could impair the computer hardware's ability to function as designed. The
    13·1 answer
  • Material science focuses on<br><br> A) Heat<br> B) Solids<br> C) Liquids<br> D) Gasses
    7·2 answers
  • How to allow all users to access a program?
    12·1 answer
  • Define decomposition
    9·1 answer
  • In Windows applications, a ____ control is commonly used to perform an immediate action when clicked.a. text boxb. buttonc. wind
    7·1 answer
  • When your purchases are swiped over the bar-code reader at the point-of-sale terminals at Wal-Mart, a _____ records the data.
    8·1 answer
  • Update thejavafile names to include your initials at the end, send .java file only.1. Completein-place heapSort, which takes an
    11·1 answer
  • FIRST TO Answer for free brainlest. GOG GOGOGO
    14·2 answers
  • The _____ Tag surrounds all content that will be visible on your web page for all to users to see on that website.
    13·1 answer
  • What are the steps for rearranging the layout of a form?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!