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
raketka [301]
3 years ago
13

Random Star

Computers and Technology
1 answer:
Tatiana [17]3 years ago
3 0

Answer:

Explanation:

The following code is written in Java. The function takes in the random object and creates a random number where it generates a random number and prints out the * characters, if the random number and the input num are the same it prints out both values and ends the function.

import java.util.Random;

class Brainly {

   public static void main(String[] args) {

       Random r = new Random();

       randomStar(r, 12);

       System.out.println();

       randomStar(r, 19);

   }

   public static void randomStar(Random r, int num) {

       while (true) {

           int randomNum = r.nextInt(19) + 5;

           if (randomNum != num) {

               for (int x = 0; x < randomNum; x++) {

                   System.out.print("*");

               }

               System.out.print("\n");

           } else {

               for (int x = 0; x < randomNum; x++) {

                   System.out.print("*");

               }

               System.out.print("\n");

               System.out.println("Random Number: " + randomNum);

               System.out.println("Input Number: " + num);

               break;

           }

       }

   }

}

You might be interested in
Should a waiting thread receive priority over a thread first attempting to enter a monitor? What priority scheme, if any, should
nadezda [96]

Answer:

Yes, thread should have a priority level. Threads are scheduled to run based on their scheduling priority. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31.

Explanation:

Threads generally are given different kinds of priorities based on the types of work the threads will be used for. This is normally known as scheduling and it is a vital procedure in thread prioritization. The standard priority levels for every thread is from the lowest priority which is typically '0' and the highest priority which is approximately 31.

6 0
3 years ago
Which header provides functions that deal with exceptional conditions?
Lyrx [107]

Answer:

<exception> header provides functions for exception handling in c++.

Explanation:

Exceptions gives a way to respond to exceptional conditions (like runtime errors) in codes by transferring the control to other special functions called handlers. Since try,catch and throw can work in the iostream header file.To use more functions like unexpected,current_exception,rethrow_exception we need exception header file.

3 0
4 years ago
What is occurring when an attacker manipulates commonplace actions that are routinely performed in a business?
serg [7]

Answer:

Vulnerable business processes, also called business process compromise (BPC), occurs when an attacker manipulates commonplace actions that are routinely performed.

4 0
3 years ago
Mario kart is mercedes lol
anyanavicka [17]

Answer:

facts xD

Explanation:

6 0
3 years ago
Read 2 more answers
____ privileges for data involve establishing who can enter new data, change existing data, delete unwanted data, and view data.
Stolb23 [73]
Administrator privileges
6 0
3 years ago
Other questions:
  • Which is true about POP3 and IMAP for incoming email?
    6·1 answer
  • What is the average reading rate for middle school students?
    12·1 answer
  • I really love my voice when not recorded. Now when I record my voice, I feel like its high pitched and horrible. Do I really sou
    11·1 answer
  • What two windows tools can you use to know how much ram is installed on your system?
    10·1 answer
  • What is the exposition of the movie inside out
    13·2 answers
  • Write two statements to read in values for my_city followed by my_state. Do not provide a prompt. Assign log_entry with current_
    13·1 answer
  • Can someone please help me
    15·1 answer
  • WILL GIVE BRAINLIST IF ANSWER IS RIGHT AND YOU TELL ME HOW YOU GOT YOUR ANSWER (dont copy and past from a site)
    10·2 answers
  • Why computer is used in education sector<br>​
    7·2 answers
  • Will creates an entry in his calendar and marks it as an all-day instance. Which item has he created?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!