Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 13:00, mariahrpoulin9630
Which part of the cpu accepts data?
Answers: 1
image
Computers and Technology, 23.06.2019 03:30, mem81
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
image
Computers and Technology, 23.06.2019 17:30, Artemis3821
Scientists have changed the model of the atom as they have gathered new evidence. one of the atomic models is shown below. what experimental evidence led to the development of this atomic model from the one before it? a few of the positive particles aimed at a gold foil seemed to bounce back. the colors of light emitted from heated atoms had very specific energies. experiments with water vapor showed that elements combine in specific proportions. cathode rays were bent in the same way whenever a magnet was brought near them.
Answers: 2
image
Computers and Technology, 24.06.2019 01:30, quintinlarrieu
How would you cite different books by the same author on the works cited page? moore, jack h. folk songs and ballads. salem: poetry press, 1999. print. moore, jack h. ballads in poetry – a critical review. dallas: garden books, 1962. print. moore, jack h. folk songs and ballads. salem: poetry press, 1999. print. –––. ballads in poetry – a critical review. dallas: garden books, 1962. print. moore, jack h. ballads in poetry – a critical review. dallas: garden books, 1962. print. moore, jack h. folk songs and ballads. salem: poetry press, 1999. print. moore, jack h. ballads in poetry – a critical review. dallas: garden books, 1962. print. –––. folk songs and ballads. salem: poetry press, 1999. print.
Answers: 2
Do you know the correct answer?
Ihave a couple of questions on java for my homework
21229
assume the availability of a m...

Questions in other subjects:

Konu
Mathematics, 08.01.2021 17:50