Program Development

There are several full length programs in the book. I would like you to copy these pieces of code and get them to run. Your code must have the following template:

```def main():
# the body of the program
...

main()
```
Each program will be in a file by itself with .py extension. You must make sure that it runs as shown in the book. These programs do NOT have to be turned in. However, you are likely to see variations of these programs in the quizzes.

• Listing 2.2: ComputeAreaWithConsoleInput.py
• Listing 2.3: ComputeAverage.py
• Listing 2.4: ComputeAverageWithSimultaneousAssignment.py
• Listing 2.5: DisplayTime.py
• Listing 2.6: SalesTax.py
• Listing 2.7: ShowCurrentTime.py
• Listing 2.8: ComputeLoan.py

Number Conversions

1. Convert the following numbers in decimal to 8-bit 2's complement binary: 28, -39
2. Write the binary equivalent of all numbers from 0 to 15 in 4-bit binary.
3. These are 8-bit 2's complement binary. What decimal numbers do they represent?
• 0110 1100
• 1111 1111
• 1000 0000
• 0111 1111
4. Convert the following numbers to unsigned binary, octal, and hexadecimal: 25, 32, 67, 96.
5. Convert these numbers in octal to binary, decimal, and hexadecimal: 672, 215.
6. Convert these hexadecimal numbers into binary, octal, and decimal: 2A5, D0C.
7. The hexadecimal number B4 is a 2's complement number in 8-bit binary. Convert it to decimal.