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 method to accept stack containing some elements

Write a method that accepts a stack containing some elements from the file "Q1.txt" and returns a new stack containing the same elements and in the same order as the original stack.

  Program to read the contents of file into the array

Write down the program which asks user for a file name. Suppsoe the file contains the series of numbers, each written on separate line.

  Design a website by using php and mysql to order pizza

Your task for this project is to design a website by using PHP and Mysqlto order pizza - A website with a complete catalog of pizzas with possible add-on options and customers should be able to prepare and customize an order as per their preference..

  Design program that asks user to enter budgeted amount

"Design a program that asks the user to enter the amount that he or she has budgeted for a month. (For example: $2,000.00)

  Creating main function that opens the input file

Create a main function that opens the input file, reads each line, and based on first character in input line, calls the [A]dd function or [M]ultiply function.

  Write program to read file consisting of students test score

Write program which reads a file consisting of students test scores in range 0-100. It muts then determine number of students having scores in each of the ranges.

  Name few languages that allow use of variables

What is a keyword in a programming language? Why it is not a good practice to use reserved words as variable names?

  London underground fire at the kings cross underground

london underground fire at the kings cross underground station on 18 november 1987 a wooden escalator caught fire

  Create an output sequential file

CSDP241 Program 06 - Program involves working with alternate indexes in indexed files and this program involves working with alternate indexes in indexed files.

  Explain how perl deallocates dynamic memory

It's one thing to TALK about how Perl manages dynamic memory. it is another thing completely to SEE how Perl manages dynamic memory.

  Write statement to assign new value to element of array

Write a single statement that assigns a new value to element of the array indexed by j . This new value should be equal to twice the value stored in the next element of the array.

  How can you tell whether an exception is checked or

questionnbsp how can you tell whether an exception is checked or unchecked? what is required of checked exceptions

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