Write a program that reads a binary number from keyboard

Assignment Help Programming Languages
Reference no: EM13951363

Write a program that reads a 4-bit binary number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, theoutput 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.)

Input Notes: Just a 4-bit string , like 1101 or 0010.

Output Notes (Prompts and Labels): The input is prompted for by:

Enter a four bit binary value .

After input, the program prints out a line of this form:

The value of BBBB is D

where BBBB is the binary string entered and D is the calculated decimal equivalent.

SPECIFICATION OF NAMES: Your application class should be called FromBinary.

Reference no: EM13951363

Questions Cloud

Perform the bea at what point does breakeven occur : calculate the net present value of these costs and benefits also calculate the overall return on investment of the project and then present a breakeven analysis , perform the BEA at what point does breakeven occur?
Write an algorithm that gets as input three data values : Write an algorithm that gets as input three data valuesx,y, andz and outputs the average of these values if the value ofx is positive.
What is his weight at the surface of the earth : Four stars of different mass arrive on the Main Sequence of the Hertzsprung-Russell Diagram at the same time. Which star has a mass just about the same as the mass of the Sun?
Discuss the importance of internal customer satisfaction. : IT infrastructure groups are often responsible for direct customer interaction and associated customer service. Note ways IT organizations can improve the quality and perception of their service
Write a program that reads a binary number from keyboard : Write a program that reads a 4-bit binary number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, theoutput should be 12.
Reallocation of activities that would result in increased : (a) What is the maximum number of people that can be processed in one hour? (b) Discuss the implications of a 5th volunteer being assigned to help administer vaccinations. (c) Using five volunteers, suggest a reallocation of activities that would re..
Construct a context diagram & determine the shared phenomena : Define the problem diagram for this scenario
Determine the material price variance : Determine the material price variance and the material quantity variance, and record the related journal entries for May.
Wholesale nursery delivering seedlings : Kelly's Garden supplies have opened up a wholesale nursery delivering seedlings to towns in Southern NSW. Because of the fragility of the product it is decided to establish a distribution centre to become a central hub within a 2 hour drive of all..

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd