filmov
tv
Java Practice It | Exercise 5.4: randomX | method basics, random, while loops

Показать описание
How to use random:
Summary:
Print a character a certain many amount of times depending on a random range of values. After a certain many values the program will quit.
More practice its:
Problem:
Question:
Write a method named randomX that keeps printing lines, where each line contains a random number of x characters between 5 and 19 inclusive, until it prints a line with 16 or more characters. For example, the output from your method might be the following. Notice that the last line has 17 x characters.
Summary:
Print a character a certain many amount of times depending on a random range of values. After a certain many values the program will quit.
More practice its:
Problem:
Question:
Write a method named randomX that keeps printing lines, where each line contains a random number of x characters between 5 and 19 inclusive, until it prints a line with 16 or more characters. For example, the output from your method might be the following. Notice that the last line has 17 x characters.