CPSC120A
Fundamentals of Computer Science I

Lab 4

Drawing

Use the command line to create a new directory called lab4 in your labs directory. Make sure all of the .py files that you create for this activity are in that directory.

Measuring Trees

The American Forests Big Tree program maintains a database of the largest trees of hundreds of species for states in the US. Determining the size of a tree consists of measuring the height, girth, and spread of a tree. Measuring the height of a tree is accomplished by using clinometer to measure the the angle of a line of sight to the top of the tree.

In Emacs, create a Python program in a file called tree_height.py. The program should print the height of a tree when a clinometer reads 51 degrees, the clinometer is 5 feet 6 inches from the ground, and 300 feet from the trunk of the tree. The height of the tree can be computed using the function:

hc + d ⋅ tanθ = ht

Where d is the distance from the clinometer to the tree, θ is the clinometer angle, hc is the height of the clinometer, and ht is the height of the tree.

Draw a Smiley Face

In Emacs, create a Python program in a file called smiley.py. The program should draw a smiley face, like the one below, using the Pygame Module's draw functions.

Design Document

A design document is a written description of software that is created by software designers to specify exactly the functionality, appearance, and structure of a program. A design document is used by software engineers to partition and coordinate the work on a program.

Create a design document for your assignment 1 program, on paper. The functionality of the program is limited by the assignment requirements, and determining the structure of the program is part of the assignment. So the design document should only include an illustration of the program's appearance.

Once you have completed your design document, please show it to me for approval.

Submission

Please show your source code and run your programs for the instructor or lab assistant. Only a programs that have perfect style and flawless functionality will be accepted as complete.