Starting from:

$30

Introduction to Programming and Problem Solving Homework #1


CS-UY 1114 Introduction to Programming and Problem Solving 
Homework #1

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.
Submission    instructions:
1. You should    submit    your    homework    in    the    NYU Classes system.
2. For    this    assignment    you    should turn    in 3    files:
• A    ‘.pdf‘ file    with    the    base    conversions (For    questions    1    and    2).    
Make    sure    to    include    the    conversion    calculations, not    just    the    final    
answer.    
• Two    ‘.py’ files,    one    containing    a    script    for    question    3    and    the    other    for    
question4.    Name    your    files    ‘q3.py’ and    ‘q4.py’ respectively.

More products