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
One difference between multi-tasking using fork() versus using threads is that there is race condition among threads due to shar
MAXImum [283]

Answer:

vnn

Explanation:

7 0
3 years ago
Read 2 more answers
An important result of the development of anesthesia was?
Ksju [112]
It could be #2 since the patient would be asleep under the anesthesia they would be able to perform amputations more often since the patient would not be able to feel the pain during the procedure. It could also be #3 because if the patient is asleep you could use a more direct approach instead of avoiding certain procedures that would put the patient in a lot of pain if it was performed while they were awake. In all I would say the answer is #2, please comment which is the right answer, thank you.
7 0
4 years ago
What are table buffers?
laiz [17]

Answer:

Table buffers are tools used to avoid the process of accessing a database in servers.

4 0
3 years ago
What is a feature of readable code?
mamaluj [8]

Answer:

sorry for the wait but the answer is b

Explanation:

5 0
3 years ago
Read 2 more answers
Which expansion slot is best for high-end dedicated video cards?
Contact [7]

Solution:

It is done Motherboard.

The motherboard includes most of the slots that we'll run into these days. It's a little unusual in that we don't often see motherboards which have both PCI-Express slots and an AGP slot. The best slot to use for video cards is the PCI-Express x16 slot. The next best is the AGP slot. The next best is a PCI-Express x1 slot but video cards which fit that slot are very hard to find as of late 2006. Some low-budget computers are sold with integrated video and have neither PCI-Express x16 slot or an AGP slot.

3 0
4 years ago
Other questions:
  • Jane, an employee in the human resources department, has created several important PDF documents on her computer that all office
    9·2 answers
  • What is virtual memory?
    11·1 answer
  • When 2 or more computers are connected it is called?
    14·1 answer
  • Use a recursion tree to determine a good asymptotic upper bound on the recurrence T(n) = 4T(n/2 + 2) + n. Use the substitution m
    5·1 answer
  • When setting up a file system that is intended to be shared among several users, it is good practice to configure permissions so
    5·1 answer
  • Is a pocket watch consider a computer
    15·1 answer
  • which feature of organisations to manage needs to know about to build and use information system successfully
    6·1 answer
  • Class function which is called automatically as soon as the object is created is called as __
    6·1 answer
  • Which information can you apply to every page of your document with the page layout options?
    9·1 answer
  • Braxton is writing a program to design t-shirts. Which of the following correctly sets an attribute for color?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!