1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ohaa [14]
3 years ago
8

Write a recursive method, numToString, that takes two arguments: num, the number to convert, and base, the base to represent the

number in. For instance, calling numToString(10, 2) returns the decimal number 10 as the base-two (binary) string "1010". Your method should work with any base 2 <= base <= 36. g
Computers and Technology
1 answer:
AnnyKZ [126]3 years ago
6 0

Answer:

This is the required code:

Explanation:

public class NumberToString {

   public static String numToString(int num, int base) {

       final String digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

       if (num < base) {

           return "" + digits.charAt(num);

       } else {

           return numToString(num / base, base) + digits.charAt(num % base);

       }

   }

}

You might be interested in
When Clara accesses the programs and documents on her computer by way of icons, she is said to be employing
xxMikexx [17]
<span>D - graphical user interface</span>
5 0
3 years ago
Which of these is a neologism created as a result of the information age?
katrin [286]

The neologism created as a result of the information age is  Bromance (meaning "a male friendship").

<h3>What is  Neologism?</h3>

A neologism, is known to be a word, or phrase that tells or implies the process of an isolated thing entering common use, but have not been fully taken in by all.

Note that The neologism created as a result of the information age is  Bromance (meaning "a male friendship").

Learn more about neologism  from

brainly.com/question/9724482

#SPJ1

3 0
2 years ago
Write a bool function isPalindrome that takes one string parameter and returns true if that string is a palindrome and false oth
kkurt [141]

Answer:

Here is the bool function isPalindrome:

bool isPalindrome(string s)

{  bool palindrome;      

 int j;

 int len = s.length();

 for (int i =0, j= len-1; i < len/2; i++, j--)  

   if (s[i] == s[j])

     palindrome = true;  

   else

     palindrome = false;

 return palindrome; }

Explanation:

The bool function isPalindrome takes a string as parameter and returns true if the string is a palindrome or false if the string is not palindrome. The string variable s holds the string value. In function isPalindrome, there is a bool type variable palindrome. bool is a data type which is used to hold values true or false which is then stored in the palindrome variable.

Next it is being found that how many characters are there in the input string using length() function which returns the length of the string. The length of the string is stored in int type variable len.

Next the for loop starts which has two variables i and j where i starts at 0 position of the input string and j starts at the last position of the string. These two variables move or traverse along the string this way. i variable stops when half the length of the input string is reached. At the end of every iteration i moves forward by the increment of its value to 1 and j moves backwards by the decrement  of its value to 1.

Every the body of  the loop executes, there is an if condition in the body of the loop which checks if the string is a palindrome. This is checked by matching the character at position/index i with the character at position j of the string. This will continue character by character until the i reached half the length of the input string and if every character in i was matched to every character in j then palindrome = true; statement is executed which returns true as the string is a palindrome otherwise palindrome = false; is returned as the string is not a palindrome.

For taking input string from the user and to check if the function isPalindrome() works correctly a main() function is written which takes input string from the user and reads in variable str calls isPalindrome() function. If the string is palindrome then the cout statement in main() function prints the message: String is a palindrome and if the input string is not a palindrome the the following message is displayed in the output screen: String is not a palindrome

int main()

{

string str;

cout<<"Enter a string: ";

cin>>str;

if(isPalindrome(str))

cout<<"String is a palindrome";

else

cout<<"String is not a palindrome";

}

The screenshot of the program along with the output is attached.

7 0
3 years ago
While ________ is centered on creating procedures, ________ is centered on creating objects. Procedural programming, class progr
AlexFokin [52]

Answer

Procedural programming, Object-oriented programming

Explanation

Procedural programming is a type of computer programming language that specifies a series of well structured steps and procedures  within its development period of time. It contains a systematic order of statements, functions and commands to complete a computational task or program. It is centered on creating procedures. While object oriented programming is a programming language that is centered on creating objects rather that actions and data rather than logic.. It has four principles which are inheritance, polymorphism, abstraction and Encapsulation


4 0
3 years ago
What does median mean in the data?
QveST [7]

Answer:

What data? Also, if it's median wouldn't that be Mathematics? edit-im sorry im d-u-m-b i thought you meant there was numbers and data but you mean the meaning of median

the median in data is the middle number and if its an even number you add the two middles together and divide by two

again sorry

4 0
3 years ago
Read 2 more answers
Other questions:
  • The ____ contains methods that allow you to set physical properties such as height and width, as well as methods that allow you
    14·1 answer
  • 10.
    13·1 answer
  • What do you call a named collection of data stored on a disk?
    15·1 answer
  • A network host with an IP address of 192.168.10.200 wants to send a message to a destination computer with an assigned IP addres
    6·1 answer
  • What is the output of the following function if the array nums contains the values 1 2 3 4 5 int backwards(int nums[]) { for (x
    15·1 answer
  • A(n) ____ is a service from local telephone companies in which up-to-date telephone facilities at the telephone company s centra
    9·1 answer
  • What are digital forensic techniques? A. Identifying, extracting, and evaluating evidence obtained from digital media such as co
    11·1 answer
  • Make a list of five primary raw materials, for each one, indicate and industrial material that is created from it
    10·2 answers
  • Explain the term creating in word processing​
    12·1 answer
  • Hewo want to talk! #bored<br>Will randomly mark brainlest
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!