subject

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.(because this problem uses random numbers, our test cases check only the general format of your output. you must still examine the output yourself to make sure the answer is correct.) this is what i got, and can not get it to work import java. util.*; public class randomx{ public static void main(string[] args){ randomx(); } publicstaticvoidrandomx(){ randomrand=newrandom(); intlinescount=rand. nextint(9)+2; for(inti=1; i< =linescount; i++){ intxcount=rand. nextint(15)+5; for(intj=1; j< =xcount; j++){ system. out. print("x"); } system. out. println(); } } }

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, ovoxotas
Which of the following commands is more recommended while creating a bot?
Answers: 1
image
Computers and Technology, 23.06.2019 04:31, mjweed3381
Cloud computing service providers manage different computing resources based on the services they offer. which resources do iaas and paas providers not manage? iaas providers do not manage the for the client, whereas paas providers usually do not manage the for their clients. iaas- storage server operating system network paas- applications interafce storage vertualiation
Answers: 2
image
Computers and Technology, 23.06.2019 09:00, vetterk1400
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
image
Computers and Technology, 24.06.2019 15:30, lizziesuks
What is the function of compilers and interpreters? how does a compiler differ from an interpreter?
Answers: 2
You know the right answer?
Write a method named randomx that keeps printing lines, where each line contains a random number of...

Questions in other subjects:

Konu
Mathematics, 13.10.2019 22:30