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
Verizon [17]
3 years ago
12

Write a method named randomStar that takes two parameters, a Random object r and an integer num. The method should keep printing

lines of * characters, where each line has between 5 and 19 * characters inclusive, until it prints a line with greater than or equal to num characters. num is guaranteed to be between 5 and 19. For example, the method call randomStar(14) will print:
Computers and Technology
1 answer:
Nostrana [21]3 years ago
3 0

Answer:

The method is as follows:

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

   int n;

   do {

       n = 5 + r.nextInt(15);

       for(int count = 0; count < n; count++){

           System.out.print("*");

       }

       System.out.println();

   } while(n < num);

}

Explanation:

This defines the method

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

This declares n as integer

   int n;

The following is repeated until n >= num

   do {

This generates a random number for n (5 and 19)

       n = 5 + r.nextInt(15);

The following loop prints n *'s

       for(int count = 0; count < n; count++){

           System.out.print("*");

       }

This prints n

       System.out.println();

   } while(n < num); The loop is repeated as long as the condition is valid

}

You might be interested in
I had about 83 GB before I installed Xcode, I was in the middle of the installation and reconsidered my decision but it's still
Natasha_Volkova [10]

You can try downloading some kind of computer cleaner like CleanMyMac X free version, also definitely restart your computer if you haven't done so already.

4 0
3 years ago
Read 2 more answers
Leslie Is doing a sociological study of people who have live remote island. She interviews the people and than she observes them
dimulka [17.4K]
Making guesses, as opposed to the other answers, this is the only one that forges new ideas and doing such will only lead to an illegitimate conclusion/study.
5 0
3 years ago
Read 2 more answers
What does PRAM stand for?
Nana76 [90]
<span>PRAM- Phase-Change Random Access Memory</span>
7 0
3 years ago
Read 2 more answers
Which element of a business document provides additional information but is not a part of the body of the text?
Vaselesa [24]

The subject is generally covered inside the body of text, so that one's out.

The footer is a completely separate part of the document, specifically the bottom-most portion of the page, but let's look at the others.

The salutation is placed at the beginning of the body of text.

And your closing note is placed at the end of the body of text.

So, the best answer would be b. footer.

3 0
4 years ago
Read 2 more answers
Advantages of desktop publishing over traditional methods include       
Licemer1 [7]
From what my teacher taught us it would be c.
6 0
3 years ago
Other questions:
  • Paul is the web page designer for his company. Paul’s boss tells him that customers have been complaining that it is difficult t
    8·2 answers
  • Are we too dependent on technology if yes then can you please explain?
    12·2 answers
  • A ___________ variable is declared outside all functions.
    15·1 answer
  • Software is giving instructions so that text is displayed on the monitor. This software is an example of _____.
    7·2 answers
  • Because it takes time to change an organization’s culture, the ISO must continually monitor security policy compliance. The ISO
    9·1 answer
  • If your vehicle leaves the pavement for any reason, remember to take your foot off the gas pedal, hold the wheel firmly, and____
    8·2 answers
  • How do you think computers have helped improve documentation, support and services within the healthcare industry
    13·1 answer
  • Algebraic concepts that include certain words and phrases and
    11·1 answer
  • What special signal is issued periodically from an Access Point and contains the network transmission rate and service set ident
    7·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!