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
Butoxors [25]
4 years ago
11

Write a program that reads a 4-bit binary number from the keyboard as a string and then converts it into decimal. For example, i

f the input is 1100, the output should be 12. (Hint: Break the string into substrings and then convert each substring to a value for a single bit. If the bits are b0, b1, b2, and b3, the decimal equivalent is 8b0+ 4b1+ 2b2+ b3.)
Computers and Technology
1 answer:
adell [148]4 years ago
7 0

Answer:

import java.util.Scanner;

public class ss11{

       public static void main (String[]args) {

             Scanner keyboard = new Scanner (System.in)

             String a1, a2, a3, a4, a5;

              int i1, i2, i3, i4, i5;

              System.out.println("Enter a four bit binary number:");

               a1= keyboard.next();

               a2= a1.substring(0,1);

               a3= a1.substring(1,2);

               a4= a1.substring(2,3);

               a5= a1.substring(3,4);

                i1 = Integer.parseInt(a2);

                i2 = Integer.parseInt(a3);

                i3 = Integer.parseInt(a4);

                i4 = Integer.parseInt(a5);

                i1= i1 * 8;

                i2= i1 * 4;

                i3= i1 * 2;

                i4= i1 * 1;

                i5= i1+i2+i3+i4;

                System.out.println("The converted decimal number is: +i5);

}

}

Explanation:

You might be interested in
What mechanism can organizations use to prevent accidental changes by authorized users?.
AlladinOne [14]

The process of monitoring and managing changes to software code is known as version control, commonly referred to as source control.  Version control ensures that two users cannot update the same object.

<h3>What is meant by Version control?</h3>

A series of software engineering tools called version control regulates how changes are made to texts, sizable websites, computer programmes, and other collections of information. Version control is a component of software configuration management.

Version control, often known as source control, is the process of keeping track of and controlling changes to software code. Version control systems are computer programmes that help software development teams keep track of changes to source code over time.

Version control improves teamwork and communication while assisting software development teams in keeping track of code changes. Version control enables straightforward, ongoing programme development.

To learn more about version control refer to:

brainly.com/question/26533170

#SPJ4

4 0
2 years ago
Your company wants to use an IoT device but wants to make sure it does not interfere with other RF devices that use the 2.4 GHz
jonny [76]

Answer:

C. Z-wave

Explanation:

The Z wave is a wireless communications protocol used primarily for automation. The Z- wave operates using a mesh network and then uses low energy radio waves to communicate from appliance to appliance.

The Z wave operates on a lower frequency than most other popular RF devices, thus making interference nonexistent.

The range of the Z-wave is 100m. Hence, it can give a perfect coverage from the base station to the company.

<em>Option A is wrong</em> . This is because the Zigbee is insecure and has a low coverage range (10m-20m). This means that there are possibilities of interference and also improper coverage beyond 50 m.

<em>Option B is wrong.</em> This is because Bluetooth devices are insecure, can loose connections under certain conditions. They have a range of 10m which is a lot lower than 50m benchmark.

<em>Option D is wrong</em>. NFC stands for Near Field Communication. This means its range is practically about 4cm and it cannot be used for long ranges as the company intends.

6 0
4 years ago
How will you maintain electrical tools and equipment?
PSYCHO15rus [73]
Electronic tools should not rub against each other when stored. Keep all the tools in the dry area and protect them from moisture, dust, and direct sunlight. To prevent injuries, keep the sharpen tool in a tool holder.
4 0
3 years ago
Read 2 more answers
List 7 ways of generating<br>airlines​
rjkz [21]

Answer:

1. <em>impr</em><em>ove</em><em> </em><em>air</em><em> </em><em>qua</em><em>lity</em><em>.</em><em>.</em>

<em>2</em><em>. </em><em>Eats</em><em> </em><em>food</em><em> </em><em>rich </em><em>in</em><em> </em><em>antio</em><em>xidants</em><em>.</em><em>.</em><em>.</em>

<em>3</em><em>. </em><em>Stop</em><em> </em><em>smok</em><em>ing</em><em>.</em><em>.</em><em>.</em><em>.</em>

6 0
3 years ago
Read 2 more answers
The memory units that follow are specified by the number of words times the number of bits per word. how many address lines and
statuscvo [17]
A) - 2G = 2 * 2^30 = 2^31 words therefore you need 31 bits to specify a memory location( 31 address line). 
<span>- If your word has 32 bits then you need 32 data lines. </span>
<span>- The # of bytes is (2 * 2^30 * 2^5 )/ 8 = (2^36) / 8 = 2^36 / 2^3 = 2^33 bytes </span>
8 0
3 years ago
Other questions:
  • The variable sentence stores a string. Write code to determine how many words in sentence start and end with the same letter, in
    13·1 answer
  • "if you add text, delete text, or modify text on a page, word recalculates the location of automatic page breaks and adjusts the
    15·2 answers
  • Which of the following is a valid format symbol in Microsoft Excel? Dollar Sign, Comma, Percent Sign or all of them? I can't fig
    14·1 answer
  • Based upon the contents of the BOOKS table, which line of the following SQL statement contains an error?
    13·1 answer
  • A palindrome is any word, phrase, or sentence that reads the same forward and backward. Here are some well-known palindromes: Ab
    11·1 answer
  • Word processing software programs can run on smartphones.<br> True<br> Or <br> False
    6·1 answer
  • Why do designers use tonal shading?
    10·2 answers
  • Why is it important to ensure that your software is up to date?
    13·1 answer
  • Write aemail to brother for laptop for vitrual classes​
    7·2 answers
  • Which are malicious codes?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!