Random Star
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:
import java.util.*;
public class RandomStar {
public static void main(String[] args) {
Random r = new Random(2063064142); // ignore the 2063064142
randomStar(r, 12);
System.out.println();
randomStar(r, 19);
}
public static void randomStar(Random r, int num) {
}
}

Answers

Answer 1

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;

           }

       }

   }

}

Random Star Write A Method Named RandomStar That Takes Two Parameters, A Random Object R And An Integer

Related Questions

Who is MrBeast?
Answer the question correctly and get 10 points!

Answers

Answer: MrBeast is a y0utuber who has lots of money

Explanation:

Answer:

He is a You tuber who likes to donate do stunts and best of all spend money.

It's like he never runs out of money.

Explanation:

PLEASE HELP ME ASAP ITS IMPORTANT

Answers

I’m 80% sure it’s the last one, I’ve studied this last year I cant quite grasp the memorie
The answer is E. Data encryption ensures the validity of the website and inserts blocks that prevent hackers and viruses from messing with the website.

When developing an algorithm to solve a problem, which of these steps can help you design the solution for the problem?

Answers

Answer:

3 is the answer please mark me brainlist

Explanation:

ok


List any two programs that are required to play multimedia products
List any two programs that are required to create multimedia products​

Answers

Answer:

the two programs to play multimedia products are;windows media player and VLC media player and the two programs to create multimedia products are;photoshop and PowerPoint

Suppose that a minus sign in the input indicates pop the stack and write the return value to standard output, and any other string indicates push the string onto the stack. Further suppose that following input is processed:
this parrot - wouldn't voom - if i put -- four thousand --- volts - through it -
What are the contents (top to bottom) left on the stack?
a. through wouldn't this.
b. this wouldn't through.
c. it through wouldn't.
d. it through volta.
e. volts through it.

Answers

Answer:

e. volts through it

Explanation:

volts through it

The contents (top to bottom) left on the stack is volts through it. Thus, option E is correct.

What is standard output?

When a computer program begins execution, standard streams are interconnected input and output channels of communication between the program and its surroundings. The three I/O connections are known as standard input (stdin), standard output (stdout), and standard error (stderr).

A negative sign in the input indicates that the stack should be popped, and the return value should be sent to standard output, whereas any other string means that the string should be pushed into the stack. Assume that the following input is processed: this parrot would not voom if I pushed — four thousand —- volts - through it.

The contents of the stack (from top to bottom) are volts via it. As a result, option E is correct.

Learn more about standard output here:

https://brainly.com/question/30054426

#SPJ5

Write a function template that accepts an argument and returns its absolute value. The absolute value of a number is its value with no sign. For example, the absolute value of -5 is 5, and the absolute value of 2 is 2. Test the template in a simple driver program being sure to send the template short, int, double, float, and long data values.

Answers

Answer:

The function in Java is as follows:

public static double func(double num){

       num = Math.abs(num);

       return num;

   }

Explanation:

This defines the function

public static double func(double num){

This determines the absolute function of num

       num = Math.abs(num);

This returns the calculated absolute value

       return num;

   }

Other Questions
The Sermon on the Mount discussed which of the following points? (multiple choice)loving your enemiessinsthe Gospel and its necessity for salvationerrors in worshippersonal conduct toward others Traumatic events are usually negative events that cause emotional upset and represent major changes in life true or false Which of these statements provides a rule for integrating digital media into an oral presentation?Never use voice over in a classroom.Always include graphs and charts.Dont read aloud text that appears on screen.Use only one form of media at a time.tysm I just do not understand the question if u could explain it would help so much! Please help and show work ASAP DUE SPON Find the area inside the 26m square and outside the circle. Use 3.14 for . A circle is fully inside a square with sides of length 26 meters, such that the circle touches the center of each side of the square. XPema's bedroom is 18 feet long and 14 feet wide. She drew the plan below todivide the room into sections. Which shows how to find the area of the StudyCorner?1) 7 ft + 4 ft = 11 sq ft11 ft7 ft10 ft + 7 ft = 17 sq ft10 ftBedStudyCorner1) 10 ft x 7 ft70 Ssq ft4 ft Play Area Closet1) 4 ft x 7 ft = 28 sq ft What would life be like in America if only the military elected members of the national legislature? What does it mean for a city/area to experience a BOOM cycle? PLEASE HELP. What does the atomic number of an element tell us? A) the number of neutrons in an atom of an elementB) the number of protons in an atom of an element C) the number of protons, electrons, and neutrons in an element In a paragraph, describe how the Underground Railroad worked. Also explain the role Harriet Tubman played in helping people escape slavery.(No Plagiarism) An Olympic-size swimming pool is approximately 50 meters long by 25 meters wide. What distance will a swimmer travel if they swim from one corner to theopposite?type your answer...meters ___________is the Old Testament book that has half of its verses in poetry An angle measures 58 less than the measure of a complementary angle. What is the measure of each angle? A $146 tent was sold for 20% off. There was a sales tax of 4%. What was the discountamount, sales tax and final cost of the tent? What is the surface area of the pyramid? Colette and Tycen made a quarts of lemonade to sell by the cup. Tycen's mother made 5 more cups of lemonade for them to sell. Theequation below can be used to find the number of cups of lemonade, c, they can sell when they make a quarts of lemonade.C = 40 + 5What is the greatest number of cups of lemonade Colette and Tycen can sell when q = 3? Lori had $126.89 in her bank account. She deposited $21.49 into it and then wrote a check for her car repairs for $156.61.What was the ending balance in her account?O -$51.21O $8.23O $8.23O $51.21What is the answer? The volume of the spear is 998 cm3. What is the approximate radius of the sphere? Use the formula v= 4/3 r3 and 3.14 for Sebastian bought 4 basketballs for $37.60 what is the rate price for per basketball? Plz stop deleting my questions! This is a urgent!!plz help meee!,