CSSE 120 -- Intro. to Software Development

Homework 7

  1. Complete the assigned reading for the next session, Zelle sections 5.1- 5.7, 5.9 (skim 5.8 as reference). 
  2. (24 Points) Complete the Angel quiz over this reading. You'll find this on the course Angel page,
    under Lessons → Homework → Homework 7 → Graphics and Objects
  3. (15 points) File Output
    1. Storing information in files is a very important exercise for engineers running experiments that generate a large quantity of useful data.  The stored data can later be analyzed, categorized, and manipulated to allow engineers to draw useful conclusions.  Last time you did this problem, you wrote the data to the screen; this time, you will actually write it to a file.

      Often, the generated data is formatted so that another program can automate the process of analyzing, categorizing, and manipulating the data. In this problem you are to write a program, funcDump.py, that implements the following design:

    2. Prompt the user for a number of data points, num,  to list.
    3. Write that many points to the a file named cos.txt, as described below:
    4. Write num lines to the file. Each line should have the data:

      n      200 + 200cos(nπ/180)

      where n ranges from 0 to num - 1. Make sure the output is neatly formatted so numbers and decimal points line up. Below is a sample of the expected output. Your program's output should match this format exactly.

       98   172.165
      99 168.713
      100 165.270
      101 161.838
      102 158.418
      103 155.010
      104 151.616
      105 148.236
      106 144.873
      107 141.526
      108 138.197
      109 134.886
      110 131.596
      111 128.326
      112 125.079
      113 121.854
      114 118.653
      115 115.476
      116 112.326
      117 109.202
      118 106.106
      119 103.038
      120 100.000
      121 96.992
      122 94.016

Submit your Python source file and the generated output to the funcDump Drop Box in the Homework 7 folder on ANGEL.

If this assignment seems short to you, you may want to look ahead to homework 8.  Homework 8 is all about objects and graphics.

  1.  Web link --- ACM SIGGRAPH: SIGGRAPH has been serving over 8,000 ACM SIGGRAPH members and the entire computer graphics and interactive techniques community. This site is home of many interesting articles on the computer graphics field.
  1. More Python culture: What's up with the shrubbery examples? Check out this visit of King Arthur to the Knights Who Say “Ni!”.