Introduction to Computer Programming II

CSI32
Section 2693
Monday,Wednesday, 12:00pm-1:50pm, room CP 123

 
  • HW11 (due date: Wednesday, May 5th, given at lecture 21) - last HW assignment

    Write the program that finds Ackermann Function.
    For testing use the table of values on Wikipedia page about this gunction.


  • HW10 (due date: Monday, April 19 th, given at lecture 16)

    Modify the program we discussed in class (the latest version):
    • Write the functions for subtraction, multiplication and negation of mixed numbers,

    • take care of the negative mixed numbers (update all the methods/functions to accommodate negative mixed numbers)

    • Hint: sign can be stored as a separate attribute or “attached” to the whole part


  • HW9 (due date: Monday, April 12 th, given at lecture 14)

    page 235 / exercise 6.18

  • HW8 (due date: Wednesday, April 6th, given at lecture 12) - corrected in the evening of March 21st

    Read sections 5.2 and 5.5,

    Write a program that converts a numeric string (in given base) to the decimal number (base 10). Do the error checking. - exercises 5.26 and 5.35

    Limit the range for the base to 2 <= base <=16
    More comments will be posted shortly

  • HW7 (due date: Wednesday, March 24 th, given at lecture 11)

    Exercises 4.35,
    4.39 (bound the highest possible number for the user to enter to 9), and
    5.9

  • HW6 (due date: Wednesday, March 17 th, given at lecture 9) - updated:

    Write a program that draws a composite object (i.e. not a square, rectangle, or circle) in the top left corner of the graphics window, then moves this object to the right bottom corner of the window, and then moves it to the right top corner of the window.
    During the movement object should change it's color at least 10 times, flip at least 10 times, and rotate at least 10 times.
    Movement should be smooth (without jumps).
    Afterwards in order to notify the user that the program won't do anything else display a text, saying something like "That's it!"

    Program must be well-commented.

  • HW5 (due date: Wednesday, March 10 st, given at lecture 8):

    1. Do exercise 2.27 on page 85

    2. Draw an evaluation tree for the following statements:

        (a) 23 + 10 ( 22 * 3 - √ 64 )
        (b) exercise 2.29 on page 85

    3. Do exercise 2.36 on page 86

  • HW4 (due date: Monday, March 1 st, given at lecture 6):

    1. page 84 / 2.21

    2. Write a program that takes a list of strings from the user, and then if an element of the list is a string of digits (we assume that user knows how to input a list, using brackets, commas and single quotes), the program converts all such elements to whole numbers (positive integers), and replaces the corresponding elements of the list with these numbers.

    Example of input-output:
    Input: ['Hello', 'buy', 'mind', '5', 'abc', '12', '0', '1243', 'thank you', 'sorry', '432', 'mind', '5', 'Hello', 'George']
    Output: ['Hello', 'buy', 'mind', 5, 'abc', 12, 0, 1243, 'thank you', 'sorry', 432, 'mind', 5, 'Hello', 'George']

    Don't forget to comment your program

    Exercises for self-practice (not for grade): 2.17, 2.18
    (answers are given at the end of the book)

  • HW3 (due date: Wednesday, March 3 th, given at lecture 4): - comment added on 03/01 (see bellow)

    Write a program that takes a list of strings as an input (from user, from keyboard), echoes it to the display and then allows the user to play with it, i.e. each time user is given the result along with the menu of things he/she can do with it.

    snapshot:
    Here is what we have at this point: ['Hello', 'buy', 'mind', '5', 'abc', '12', '0', '1243', 'thank you', 'sorry', '432', 'mind', '5', 'Hello', 'George']

    What would you like to do?
    1. Find a first occurrence of an item
    2. Find all occurrences of an item
    3. Add an item to the end of the list
    4. Remove an item from the list
    5. Insert an item into specified position
    6. Reverse the order of the elements in the list
    7. Replace the element at the specified position with something else
    8. Quit the program

    Input your choice and press Enter:


    When submitting HW3:
    Provide the analysis and the design of your project (see example we did in class).

    The implementation (program) itself must be well-commented.

    Also make sure that you provide a little bit of description of the program to the user.

    You will be given two separate grades:
    One for the program and one for the provided documentation (analysis, design, comments, description of the program's work)

    Comment: Please, note that user doesn't know list syntax, so he/she will input the data without any square brackets and single quotes, example of input: Hello,buy,mind,5,mom,123

  • HW2 (due date: Thursday, February 18 th, given at lecture 3):

    Page 30 / 1.20, 1.21

    Comments:

    For 1.20:
    The book has an answer for 1.20, but try to do it on your own first, and then, if needed, refer to the solution. Please, note that we did not create Schedule class and hence didn't use it in our scenarios, so you shouldn't use it either.

    For 1.21:
    Assume that we will have a Transcript class. Design it, and then use it for this problem.

    The book says: “Transcript class can be defined to represent a student's complete history of courses. Attributes of an object can reference other objects”

  • HW1 (due date: Wednesday, February 10 th, given at lecture 2):

    p. 29 № 1.19, and 1.27 or 1.31

    Comment: Use Dia for making the diagrams.
    If you didn't install Dia yet, then you can draw the diagrams and submit them in class.
     

  • HW0 (not for grade, due date: Wednesday, February 3rd, given at lecture 1):
    • Exercise 1: Implement both algorithms that were given in class.

      Comments: it can be done as one program
      Input: from keyboard

      Modifications:
      1. Input from a file
      2. Ability to run the algorithms on as many input pairs as the user wants
      3. Use graphics

    • Exercise 2: p. 29 № 1.5 or 1.8

    • Install Python on your computer, if you don't have it on your home computer.
      (see handouts or home page for information on installation)