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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 12:50, michaelchavez6959127
You have just been hired as an information security engineer for a large, multi-international corporation. unfortunately, your company has suffered multiple security breaches that have threatened customers' trust in the fact that their confidential data and financial assets are private and secured. credit-card information was compromised by an attack that infiltrated the network through a vulnerable wireless connection within the organization. the other breach was an inside job where personal data was stolen because of weak access-control policies within the organization that allowed an unauthorized individual access to valuable data. your job is to develop a risk-management policy that addresses the two security breaches and how to mitigate these risks. requirementswrite a brief description of the case study. it requires two to three pages, based upon the apa style of writing. use transition words; a thesis statement; an introduction, body, and conclusion; and a reference page with at least two references. use a double-spaced, arial font, size 12.
Answers: 1
image
Computers and Technology, 22.06.2019 18:00, alyssacyamamoto8050
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
image
Computers and Technology, 23.06.2019 13:00, jaelynnm
Donnie does not have powerpoint. which method would be best for elana to save and share her presentation as is? a pdf a doc an rtf a ppt
Answers: 3
image
Computers and Technology, 23.06.2019 14:30, officialrogerfp3gf2s
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
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 in other subjects: