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

  Implement the calculator using stacks and queues

You will implement the calculator using stacks and queues. Your calculator should support following operators: Parenthesis. The input will be given in form of infix expressions, e.g. ( 2 + 3 ) * 5.

  Program to ask how many games are being purchased

Your program should ask the store clerk how many games are being purchased and calculate a total due (with 6% tax). The total number of games, the discount amount.

  Write a function that accepts temperature in degrees

write a function that accepts temperature in degrees fahrenheit degf andcomputes the corresponding value in degrees

  Find the shortest sequence of mips instructions

Find the shortest sequence of MIPS instructions that extracts bits 16 down to 11 from register $t0 and uses the value of this field to replace bits 31 down to 26 in register $t1 without changing the other 26 bits of register $t1.

  Write function template to return number of element in queue

Add operation queueCount to class queueType (the array implementation of queues), to return number of elements in the queue. Write down the definition of function template.

  Basic concepts of object-oriented analysis and design

Diagram methods introduces the student to the basic concepts of object-oriented analysis and design. Use case modeling, class modeling and state modeling using common notations are covered

  Modify the dynamic programming algorithm

How would you modify the dynamic programming algorithm for the coin collecting problem if some cells on the board are inaccessible for the robot?

  Create a new project in your ide named exceptionhandler

Create a new project in your IDE named "ExceptionHandler." Write code to accept numbers as described above from the user. Your code should ensure that only numbers are accepted.

  What is a feature of good program design

Variables declared within a module have what scope? In what way do named constants differ from variables? What is a feature of good program design

  Create a windows form application project.

After these two selections are made the user will click the Selection Complete button that will compute the total price of rental

  Create a class named rectangle with length and width

To cover that floor with carpet that costs $8 per square foot would cost $960. (12 x 10 x8 = 960.). You should create a class named Rectangle with the following properties:

  Program that prompts user to enter five test scores

Write the algorithm for a program that prompts the user to enter five test scores.

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