ECE-1021

Exam #2 Make-up

(Last Mod: 27 November 2010 21:38:41 )

ECE-1021 Home


Due Date: No Later Than midnight 11 Dec 04. There is NO grace period.

The program name should be the same as if this were homework assignment X.

Ground Rules: This is an opportunity to earn as much as 50 pts added to your Exam #2 score. Just as the Exam was a solo effort, so is this. There is to be NO (zero, zip, nada) discussion of this assignment with anyone also or any form of collaboration whatsoever. Any indication of any collaboration will result in no credit being given to any of the involved parties. Do your own work and do not discuss this assignment with anyone else and you will be fine.


Task #1

Write a program that asks the User for a 16-bit string in binary. In response, the User is expected to enter a series of sixteen 1's and 0's followed by a carriage return - no spaces or anything else.

Your program should produce the corresponding decimal value for all five integer representations we have discussed this semester. An example of the output might be:

   Input string       pure  signed offset  one's  two's

1011 1100 0110 0111  +48231 -15463 +15463 -17304 -17305

Task #2

Ask the user for a signed integer value in the range of -32,768 to +32767. Output the 16-bit representations for this value in all five integer representations we have discussed this semester. If a particular value cannot be represented using a particular representation, the the program should print "non-representable" instead of a bit pattern.

decimal: -10000

   pure:  non-representable

 signed: 1010 0111 0001 0000

 offset: 0101 1000 1111 0000

  one's: 1101 1000 1110 1111

  two's: 1101 1000 1111 0000