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]
3 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]3 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
Please answer that and i'll gave you branlliest
juin [17]

num = float(input('Enter a number: '))

if num > 45.6:

   print('Greater than 45.6')

I wrote my code in python 3.8. I hope this helps.

7 0
3 years ago
Disadvantages of the divisional organization structure are _____. each division is able to operate independently from the parent
Fantom [35]

Answer:

Disadvantages:

1. A division may feel separated from the parent company because it has too much independence

2. This feeling of separation may lead to the division only worrying about meeting it's goals and objectives and not the companies as a whole

3. This system may be more expensive to operate and cannot share resources with other divisions

Explanation:

8 0
1 year ago
You would like to enter a formula that subtracts the data in cell B4 from the total of cells B2 and B3. What should the formula
anastassius [24]

Answer:

=b2 b3-b4 or something close to that, I hope this helps ^^

Explanation:

6 0
3 years ago
The National Institute of Standards and Technology (NIST) guidelines list four different states a mobile device can be in when y
Ahat [919]

Answer:

quiescent

Explanation:

The National Institute of Standards and Technology (NIST) guidelines list four different states a mobile device can be in when you extract data. The quiescent mode is a dormant mode that conserves battery life while maintaining user data and performing other background functions.

4 0
3 years ago
Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4,999. The drive is currently serving a request at cylinder 2,150,
Zina [86]

Answer:

The queue pending requests of FIFO order is ;

86, 1470, 1774, 948, 1509, 1022, 1750, 130.

Explanation:

The FCFS schedule is 143, 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130.

Total seek distance is 7081.

The SSTF schedule is 143, 130, 86, 913, 948, 1022, 1470, 1509, 1750, 1774.

Total seek distance is 1745.

The LOOK schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 130, 86.

Total seek distance is 3319.

The SCAN schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 130, 86.

Total seek distance is 9769.

7 0
3 years ago
Other questions:
  • if there are several web pages that you visit regularly what can you do to make accessing them more efficient?
    13·1 answer
  • What nondestructive testing method requires little or no part preparation, is used to detect surface or near-surface defects in
    7·1 answer
  • The process of saving files to disk is called.<br> A.read<br> B. Write<br> C. Lock<br> D. Protect
    6·1 answer
  • What is the name of the file manager in Microsoft Windows. The file manager used in Microsoft Windows is?
    12·2 answers
  • Please help!!
    8·1 answer
  • Ann needs to share information about a new hiring policy. She needs to communicate this information to more than one hundred emp
    15·2 answers
  • Literally no one helps answer my questions so this website is pointless.... : /
    11·1 answer
  • If an electric circuit has 30ohms and 10amps. How many volts the battery voltmeter should read?
    10·1 answer
  • I need a solution for this problem asap.
    7·1 answer
  • What option in the zone aging/scavenging properties dialog box will prevent dns record time stamps from being updated too often?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!