Write program that acts like a simple calculator for binary

Assignment Help Programming Languages
Reference no: EM131214182

Assignment

You will write a program that acts like a simple calculator for binary numbers. You should read in a string of input that has the format: number operator number. Each of the numbers should be presented in two's complement 8-bit form. So an input string might look like 10011011 + 00110110. You can assume that the user will enter the data in the proper format. You do not need to do error checking of the format.

You should divide up the input string into its three parts. You should then determine which operator is being used. The valid operators are +, -, *, and /. Based on the operator you should perform the corresponding mathematical operation on the two numbers after you convert each string of 1's and 0's into its proper corresponding decimal value. Based on the resulting value you can either display an error message about overflow occurring if the result is too big, or you can you can echo the desired calculation along with the answer you computed after converting it back into two's complement form. You should also print an error message if the calculation is supposed to divide by zero. Lastly, you should place this task inside a query loop that asks the user whether or not to continue performing calculations.

Make sure that you properly comment your program. Submit the source file along with sample output of your program demonstrating each of the calculation types.

Reference no: EM131214182

Questions Cloud

Why you want to use structured query language for database : Discuss the challenges of accurate data analysis upon accurate data modeling. Why would you want to use structured query language (SQL) for database design?
Constructing the confidence interval adds value : Provide an overview of the scenario and the variable involved. Include an explanation of why and how constructing the confidence interval adds value. I.e., why might this information be important to know?
Solubility curve for potassium nitrate : How does the solubility curve for sodium chloride compare with the solubility curve for potassium nitrate?
Find the pump specific speed in nondimensional form : A pump is being designed to deliver 320 gpm of gasoline at nomal temperature. - Find the pump specific speed in both nondimensional form and customary U.S form.
Write program that acts like a simple calculator for binary : You will write a program that acts like a simple calculator for binary numbers. You should read in a string of input that has the format: number operator number.
How does put work and what device does it operate with : What does the term programmable mean in used of programmable unijunction transistor? - how does PUT work and what device does it operate with?
How they relate to the concurrency control : The consistency and reliability aspects of transactions are due to the ‘ACIDity' properties of transactions. Discuss each of these properties and how they relate to the concurrency control and recovery mechanisms. Give examples to illustrate your ..
Eighty percent of all technical assistants : Fifty percent of all technical assistants would like to have a PC. Eighty percent of all technical assistants would like to have MAC. Fourty-five percent of all technical assistants would like to have both. If a technical assistant is randomly sel..
Advise stephanie for assessable income : BLO2206 TAXATION LAW AND PRACTICE ASSIGNMENT. Advise Stephanie, Roger and Rogan Advertising of their assessable income for the 2015/16 and 2016/17 tax years based on the information you have above

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