CSE 221 Homework 14


  1. In the appendix of the text for CSE 222 (appendices also used in CSE 221 and CSE 321) read the Natural_Number section. Make sure you understand the idea of radix notation. Then answer the following questions.
    1. Describe a situation, other than the one in the appendix, where using Integer objects wouldn't let you compute with values large enough to do some computation you might want to perform.
    2. Write the following numbers, shown here in decimal (radix-10) notation, in binary (radix-2) notation:
      1. 0
      2. 1
      3. 2
      4. 3
      5. 4
      6. 10
      7. 15
      8. 16
      9. 100
    3. For each of the following tracing tables, write a single statement that would take you from the initial state to the corresponding final state. Assume the following declarations:
      1. object Natural_Number_1_C n1, n2;
        object Integer k;
      2.  
      3.   n1 = 123456
        k = -42
         what statement?  
          n1 = 12345
        k = 6
      4.  
      5.   n1 = 78
        k = 9
         what statement?  
          n1 = 789
        k = 9
      6.  
      7.   n1 = 865365765768
        n2 = 9732457521
        k = 62
         what statement?  
          n1 = 9732457521
        n2 = 865365765768
        k = 62