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
RoseWind [281]
2 years ago
11

LAB: Convert to binary - methods

Computers and Technology
1 answer:
Georgia [21]2 years ago
8 0

Answer:

import java.util.Scanner;

public class Lab{

  public static String integerToReverseBinary(int number)

  {

      String binary = "";

      if(number == 0){

          return "0";

      }

      while(number > 0)

      {

          int remainder = number % 2;

          number = number / 2;

          binary += Integer.toString(remainder);

      }

      return binary;

  }

 

  public static String reverseString(String wordString)

  {

      String binaryString = "";

      int length = wordString.length();

      for(int i = length -1 ; i >= 0 ; i--)

      {

          binaryString += wordString.charAt(i);

      }

      return binaryString;

  }

 

Explanation:

In the java source code, the Lab class is defined which has two methods, 'reverseString' and 'integerToReverseBinary'. The latter gets the argument from the former and reverses the content of its string value, then returns the new string value. The former gets the integer value and converts it to its binary equivalence for which are converted to strings and returned.

You might be interested in
What caused accident? into passive voice​
lozanna [386]
Accident was caused by what
6 0
2 years ago
Daniel makes changes to a workbook named “Results.” He saves the file as “New Results” but did not realize that a worksheet name
elena55 [62]
All he would need to do is go into the sheet and change the name again. This will change the HTML so the computer will not be confused. The name should make sense, but he completely different from the original name :)
7 0
3 years ago
The incandescent test lamp is used to check for the presence of
Arisa [49]
Http://americanhistory.si.edu/collections/search/object/nmah_995750
4 0
2 years ago
What are some benefits that each computer system being used?
lisabon 2012 [21]

Answer:

Computerised accounting systems have numerous benefits to them and below are the top nine points as to why you should be using them with your business.

Automation. ...

Data Access. ...

Accuracy. ...

Reliability. ...

Speed. ...

Security. ...

Scalable. ...

Visuals.

Explanation:

hope this helps!

6 0
2 years ago
Read 2 more answers
Unwanted emails are called:malware,phishing, spam or virus
Colt1911 [192]
1. Spam
2. Phishing
3. True
3 0
3 years ago
Other questions:
  • Jannette has been experiencing slow performance on her computer. Today she received an error message saying that an update to he
    12·2 answers
  • Which of the following is not an advantage of using asynchronous data transmission
    15·1 answer
  • Given the security levels TOP SECRET, SECRET, CONFIDENTIAL, and UNCLASSIFIED (ordered from highest to lowest), and the categorie
    13·1 answer
  • How do you activate the Formula AutoComplete function of Excel 2016?
    15·2 answers
  • What are the characteristics of a severe storm
    12·1 answer
  • 17. Ano ang tawag sa pahina ng Excel?
    12·1 answer
  • g Write a function named vowels that has one parameter and will return two values. Here is how the function works: Use a while l
    9·1 answer
  • I
    6·1 answer
  • Laptop computers use PCMCIA cards, another type of ________
    15·1 answer
  • Why won't Brainly let me create an account? I have tried many times but it just loads.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!