Starting from:

$250

CS1114- Homework 1 Solved

Question           1:        

Convert              the       following        numbers         to         their   decimal           representation:         

              

a)    100110112              =         

b)    11011012    =         

c)    3A816           =         

d)    22145           =         

              

              

Question           2:        

Convert              the       following        numbers         to         their    binary             representation:         

              

a)    6910              =         

b)    48510=        

c)    6D1A16        =         

              

Question           3:        

Write     a          program         that     asks     for       the       user’s              name               and      prints              a          personalized              welcome            message          for       him.    

              

For         example,         an        execution        could               look     like:    

Please    enter    you      name:                          

Mike      

Hi           Mike,    Welcome        to         CS-­‐UY           1114   

              

              

Question           4:        

Textbook           P.80,    Q4:     

The         U.S.      Cencus            provides         information    on        its        web     page    (http://www.census.gov)     about               the       current              U.S.      population      as         well     as         approximate               rates    of         change.           Three              rates    of         change               are       provided:       

     -­‐                          There      is          a          birth    every               7         seconds.         

     -­‐                            There     is          a          death               every               13        seconds.         

     -­‐                                    There        is          a          new     immigrant      every               35        seconds.         

These     are       obviously        approximations         of         birth,    death,              and      immigration    rates,               but       they     can      assist      in         providing        population      estimates        in         the       near     term.   

Write     a          program         that     takes    years    as         input    (as       a          integer)           and      prints              out       an        estimated    population      (as       an        integer).          Assume           that     the       current            population      is          307,357,870,              and      assume              that     there    are       exactly            365      days    in         a          year.    Hint:    Note    that     the       rate     units    are       in    seconds.         

              

              

            
                                          

More products