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
Complex communication skills will probably never be outsourced to a computer because they require the human touch.
frutty [35]
True because eventually a human needs to repair the computers
4 0
4 years ago
In cryptography, the term "Secret algorithm" refers to an algorithm designed in a way that prevents the examination of its inner
Solnce55 [7]

Answer:

B. False

Explanation:

A secret algorithm is a key which uses the same key for decryption as well as encryption of data.

5 0
3 years ago
Read 2 more answers
what option can be used to create vpn connections that can be distributed to users' computers so that vpn clients do not have to
IRINA_888 [86]

This option can be used to create virtual private network (VPN) connections that can be distributed to users' computers so that VPN clients do not need to be configured on each client station is a VPN connection profile.

Users can send and receive data over shared or public networks as if their computer equipment were physically connected to a private network using a virtual private network (VPN), which extends the private network over the public network.

Increased functionality, security, and private network administration are all benefits of a VPN. It is often used by remote workers and allows access to resources that are not available on the public network. Although not an essential part of a VPN connection, encryption is often used.

By using dedicated circuits or tunneling protocols over existing networks, a VPN can be created by creating a virtual point-to-point connection.

To know more about VPN click here:

brainly.com/question/28945467

#SPJ4

6 0
1 year ago
A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To ac
Gekata [30.6K]

Answer:

# include <iostream>

#include<stdio.h>

using namespace std;

bool IsLeapYear(int y)

int main()

{

int y;

cout<<"Enter the Year to check Leap or Not"<<endl;

cin>>y;

IsLeapYear(int y);

getch();

}

bool IsLeapYear(int y)

{

if (y%4==0)

{

   if (y%100==0)

    {

         if (y%400==0 )

         {

          cout<"The year is leap Year";

         }

         else

         {

         cout<<" The year is not Leap Year";

         }

     }

     else

     {

     cout<<"The year is Leap Year" ;

     }

}    

else

{

cout<<"The year is not Leap Year";

}    

}

Explanation:

In this program a function has been defined named as IfLeapYear, to check that whether the entered year is leap year or not. An year taken as integer data type named as y to enter the year to check. If the year is divisible by 4 but not divisible by 100 is the leap year. If the year is divisible by 4, divisible by 100 and also divisible by 400 is the century year and is also the leap year.

To check all the statements, Nested if-else conditions has been used to check multiple requirements of the leap year.

6 0
3 years ago
Read 2 more answers
1. why is manufacturing considered the biggest contributor to progress
34kurt

Answer:

A vibrant manufacturing base leads to more research and development, innovation, productivity, exports, and middle-class jobs. Manufacturing helps raise living standards more than any other sector. Manufacturing generates more economic activity than other sectors.

3 0
3 years ago
Other questions:
  • convert the following c code to mips. assume the address of base array is associated with $s0, n is associated with $s1, positio
    14·1 answer
  • Yesterday you installed a new game on your computer. When you ran the computer, you noticed that the application was running ver
    15·1 answer
  • The company currently runs 60 autonomous APs and has plans to increase wireless density by 50% in the near future
    13·1 answer
  • what is the total resistance of a series circuit with four resistors in series of 12 16 20 and 24 ohms​
    14·1 answer
  • What is your favourite video game??​
    5·2 answers
  • To check spelling errors in a document, the Word application uses the _____ to determine appropriate spelling.
    7·2 answers
  • Which type of image format is constructed using proportional formulas rather than pixels? This task contains the radio buttons a
    12·2 answers
  • What is alfred anderson in creole?
    6·1 answer
  • 20 points for ez question lol
    9·2 answers
  • AfcAAgrwdsgsFsefvzsdfvbjhbdjbbjbjsdndVHFadbhZJBVdb
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!