Programming Exercise: Will sum overflow?

Write a program that takes two signed integers that can be represented using at most 16 data bits as input. (The smallest possible input to your program is therefore −216/2 or −215 or −32,768, and the largest possible input value is 216/2 − 1 or 215 − 1 or 32,767.) Your program should output a message indicating whether the sum of the two input values would overflow a 16 bit storage location, i.e. the message should indicate whether the sum requires more than 16 bits to represent.

If the programming language you are using has a 16-bit signed integer data type, then use that data type for all of the numeric values in your program. For example, if you compose a Java program, represent all numbers in your program using Java’s short or Short data type instead of int or any other data type capable of representing positive numbers greater than 32,767 or negative numbers less than −32,768.

If the programming language you are using does not have a 16-bit signed integer data type, then try to somehow create such a type, and use the custom type to compose your program.

Show hints.