Computer Programming Assignments
- <1> - Fri, 13 May 2005 12:26:35 -04001>
If you are interested in taking AP computer science next year, come find me in room 330 and sign up. You can read the Course Description and part of the Syllabus and Calendar. The course will require you to work diligently, but I think you will find it exciting and fun. I try to pace the class with a balance between making you think things out for yourself, not just giving away the answers, while still letting you see some solid progress made in a project on every given day.
Table of Contents
1. TurtlesIn the first program that you will be working with, you will be writing Java code that controls "turtles" that move around on a canvas and draw things. You can see an example of this applet working here.
Download a zip file containing everything that you need for this assignment: MrZ/Turtles.zip.
Here are the assignments that use the Turtles project:
Turtles Assignment 1
Turtles Assignment 2
- Compile a java file.
- Create an object.
- Create a variable to hold on to an object.
- Use ("call") an object's methods.
- Pass "parameters" to a method.
- Import classes.
- Vocabulary: compile; code, comment, import; declaration, instantiation, assignment, messaging; method, object, class; variable, parameter.
Turtle Plotter Case Study
- Create a new object type that extends another type.
- Write an object method.
- Write an object method that takes a parameter.
- Break down a complicated procedure into often-repeated basic steps.
- Perform mathematical operations with variables and store the results in a variable.
- Use "while" in simple situations to repeat a set of instructions a number of times.
- Vocabulary: subclass, superclass, inherit, extends; method, object, class; block, control structure, while, increment, condition.
Turtles Assignment 3
- Create a class file from scratch.
- Write an object constructor.
- Write a method that "overloads" a method of a superclass (that is, provides a new way of doing that method that may or may not do anything like what the super does)
- Create, initialize, and use instance variables.
- Use "if ... else" statements to check conditions and branch program execution.
- Vocabulary: instance variable, local variable, parameter; if, else if, else; return value.
2. AsteroidsThis program is a simple game in which you fly around in a spaceship at the bottom of the screen trying to avoid asteroids falling from the top of the screen. I wrote the code that makes the window appear, and that forwards things like key presses to the objects on screen. You will create the objects that represent the Ship, Asteroids, and Laser elements. You will then add a few new features of your own choosing.