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]
3 years ago
11

LAB: Convert to binary - methods

Computers and Technology
1 answer:
Georgia [21]3 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 are TWO examples of soft skills?
Elanso [62]
Computer programming and throubleshooting
3 0
3 years ago
Timeliness is an important goal of any access control monitoring system.<br> A. True<br> B. False
Damm [24]
The answer for this question is true
7 0
3 years ago
What have been three technological changes to photography in the past 200 years?
kolbaska11 [484]
I hope this helps but cars, phones and computers.
3 0
3 years ago
What should you commit to your family members?
olganol [36]

Answer:

Find some time to do an activity that everyone in the family will love. Maybe share a movie night, trip to the park, or play your favorite game. Don't forget that old saying, “the family that plays together, stays together.” Doing fun things as a family can help to keep everyone's spirits up and strengthen ties.

Explanation:

HOPE IT'S HELP

PLEASE MARK AS BRAINLEST ANSWER

7 0
3 years ago
calculate how many turns of cable you will need on the drum for your cage and skip to move up and down by 500 m​
anyanavicka [17]
Physics. only one, if the drum is 500m around... 50 turns. you will need on the drum for your cage and skip to move up and down by 500m. 500/18.84= 26.5.

Mark me as brainliest pls..... :)
5 0
3 years ago
Other questions:
  • Write a function wordcount() that takes the name of a text file as input and prints the number of occurrences of every word in t
    12·1 answer
  • Which of the following is considered information?
    6·2 answers
  • In JavaScript, which of the statements below can be used for string declaration?
    11·1 answer
  • Write a program that prompts the user to enter a string (may contain spaces) and displays its last character. Enter s string: Pr
    13·1 answer
  • A collection of facts can be copyrighted, but only if the collection is ____ in a way that causes the resulting work to rise to
    14·1 answer
  • In the written Hawaiian language, only 13 letters are used: the five vowels (a,e,i,o, and u), and 8 consonants (h,k,l,m,n,p,w, a
    10·1 answer
  • What is the difference between "What I ought to do?" and "What kind of person should I be"?
    12·1 answer
  • Which media vehicle uses the Dreamweaver software for its design? A(n) "blank" uses the Dreamweaver software for its design.
    8·1 answer
  • How can you protect your information when using wireless technology
    10·1 answer
  • to protect a windows 10 system, you've configured system restore to automatically protect your system using restore points. will
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!