Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CREATING A BINARY CALCULATOR WITH 2S COMPLEMENT WITHREQUIREMENTS BELOW ( MUST USE PYTHON PROGRAMMING) The answers are displayed in binary format, with decimaltranslation following.

CREATING A BINARY CALCULATOR WITH 2S COMPLEMENT WITHREQUIREMENTS BELOW ( MUST USE PYTHON PROGRAMMING)
• The answers are displayed in binary format, with decimaltranslation following.
• Results in binary notation must be printed with all leadingzeroes required for the word size. For example, the number 1 in8-bit must be printed as binary 00000001, (the “0b” prefix may beomitted, see next requirement).
• When printing the result in binary format you do not need theleading prefix “0b”. This must be done consistently throughout theprogram operation. In other words, show or don’t show the prefixconsistently.
• When announcing a result that produced an overflow, there is anadditional note printed to show overflow; it can be short butshould be obvious, something like *OVERFLOW*. The result must alsobe printed (it’s not enough to simply flag the overflow).
• Operations are entered as two possible cases:
o Two binary integers separated by an operator + or ? ;
o A single binary integer.
• The base of the input number is assumed to be binary; you mayhave the user enter the binary number with or without the “0b”prefix (this is your program design decision).
• The program is not required to interpret the Pythonsign-magnitude notation for binary (e.g. ?0b0111 for ?7).
• If the user enters a number that overflows the selected wordsize, the program flags an overflow error on input and theoperation is not executed; for example, if the word size is 8 andthe user attempts 1100010002. This restriction applies even if theresult fits in the word size, e.g. for 8 bits, 1100000001 ?1100000000.
• The program quits when the user enters a single letter ‘q’ or‘Q’

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Design Operation And Evaluation Of Mobile Communications

Authors: Gavriel Salvendy ,June Wei

1st Edition

3030770249, 978-3030770242

More Books

Students also viewed these Programming questions

Question

Students graphed their completion of homework on a class report.

Answered: 1 week ago

Question

6-11. What else (if anything) would you suggest?

Answered: 1 week ago