CMPU 101 - Assignment 2 Due: by the beginning of class (12:00 noon) on Wednesday, February 8th

This assignment is a paper-and-pencil assignment.

## Problem 1

Convert the following decimal numbers to binary:

• 3
• 24
• 111
• 179
• 395

## Problem 2

Convert the following binary numbers to decimal:

• 10000
• 1111111
• 10001100
• 100100001
• 100101011

## Problem 3

Consider the following Java variable declaration that represents some number of pennies (one-cent coins) as an int:

```int numberOfPennies = ???;
```

Note that the value used to initialize the variable has been obscured.  Assume that it contains a non-negative value, but that you don't know exactly what value it contains.

Write additional Java statements that will compute:

• The number of whole dollars (1 dollar = 100 cents) in the monetary value of numberOfPennies
• The amount of change left over after taking out the whole dollars from the amount

For example, if numberOfPennies has the value 242, then the number of whole dollars is 2, and the amount of change is 42.