subject

Ihave a couple of questions on java for my homework
21229
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 andk. 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.
20861
a palindrome is a string that reads the same forwards or backwards; for example dad, mom, deed (i. e., reversing a palindrome produces the same string ). write a recursive, boolean -valued method , ispalindrome that accepts a string and returns whether the string is a palindrome.
a string , s, is a palindrome if:
s is the empty string or s consists of a single letter (which reads the same back or forward), or
the first and last characters of s are the same, and the rest of the string (i. e., the second through next-to-last characters ) form a palindrome.
20864
a 'array palindrome' is an array which, when its elements are reversed, remains the same (i. e., the elements of the array are same when scanned forward or backward) write a recursive, boolean -valued method , ispalindrome, that accepts an integer -valued array , and a pair ofintegers representing the starting and ending indexes of the portion of the array to be tested for being a palindrome. the function returnswhether that portion of the array is a palindrome.
an array is a palindrome if:
the array is empty (0 elements ) or contains only one element (which therefore is the same when reversed), or
the first and last elements of the array are the same, and the rest of the array (i. e., the second through next-to-last elements ) form a palindrome.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:50
Write a 3-4 page apa formatted paper comparing your organization’s it strategy with the best practices outlined in your course text. content should include, but not be limited to: developing and delivering on the it value, developing it strategy for the business value and linking it to business metrics. your paper should include an abstract and a conclusion and a reference page with 3-5 references
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
question
Computers and Technology, 23.06.2019 12:50
Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark
Answers: 1
You know the right answer?
Ihave a couple of questions on java for my homework
21229
assume the availability of a m...
Questions
question
History, 26.01.2021 18:50
question
Mathematics, 26.01.2021 18:50
question
Mathematics, 26.01.2021 18:50
question
Mathematics, 26.01.2021 18:50
question
Mathematics, 26.01.2021 18:50
question
History, 26.01.2021 18:50
Questions on the website: 13722361