Mathematics
Mathematics, 24.02.2020 23:42, sarah8479

Assume the availability of a method named makeLine that can be passed a non-negative integer n and a character c and return a String consisting of n identical characters that are all equal to c. Write a method named printTriangle that receives two integer parameters n and k. If n is negative the method does nothing. If n happens to be an even number, its value is raised to the next odd number (e. g. 4-->5). Then, when k has the value zero, the method prints a SYMMETRIC triangle of O's (the capital letter O) as follows: first a line of n O, followed by a line of n-2 O's (indented by one space), and then a line of n-4 O's (indented by two spaces), and so on. For example, if the method received 5,0 (or 4,0) it would print: OOO O Note: in the above output, the first line contains 0 spaces before the first O, the next line 1 space, and so on. Note: These instructions state what the method does when k is zero, but it is up to you, the programmer, to determine what it does when k is not zero and use it for your advantage. The method must not use a loop of any kind (for, while, do-while) to accomplish its job. The method should invoke makeLine to accomplish the task of creating Strings of varying lengths.

answer
Answers: 1

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 14:30, mia2286
Chandler was a caretaker at the state zoo. he noticed that the number of animals adopted by the zoo increased at a constant rate every year since 2010. which of the following graphs shows the slowest rate at which the animals in the zoo were adopted?
Answers: 2
image
Mathematics, 21.06.2019 18:50, lolh1520
What are the values of a, b, and c in the quadratic equation 0 = x2 – 3x - 2? a = 1, b = 3, c = 2 a=, b = -3,c=-2 a = 1, b = 3, c= 2 a = 1.0= -3, c = 2
Answers: 2
image
Mathematics, 21.06.2019 19:00, michellectucker1982
What is the explicit formula for this sequence? -7, -4, -1, 2, a.) an = 8 + (b - 1)3 b.) an = -7 + (n - 1)3 c.) an = 3 + (n -1) (-7) d.) an = -7 + (n - )
Answers: 1
image
Mathematics, 21.06.2019 19:20, axelsanchez7710
The suare root of 9x plus 7 plus the square rot of 2x equall to 7
Answers: 1
Do you know the correct answer?
Assume the availability of a method named makeLine that can be passed a non-negative integer n and a...

Questions in other subjects:

Konu
Chemistry, 05.12.2020 20:30
Konu
Mathematics, 05.12.2020 20:30
Konu
Mathematics, 05.12.2020 20:30