Advanced Placement Computer Science


Course Overview
Course Policies
Computer Science AP
   Syllabus 
   Class Schedule
   Homework
   Labs
   Projects
   Extra Credit
   Study Material
   Grades
Computer Science 2 AP
Get Software
Useful Resources
Teacher Information


Projects for Computer Science AP



Project 6 -
Project 5 - What made Bill Gates famous!

** Some new notes from 4/27/04

Some tips:
  • It's probably easiest to seperate this into 3 classes
    1. A class to store information about the students (the name, the id, and their age)
    2. A class to store information about the courses (name, maximum enrollment, period, teacher... and you really need to have an ArrayList storing the students as well)
    3. A class to actually do the work that has 2 ArrayLists, one to store the students, one to store the courses.  This should also display the menus to the user, select the input, and then do the various tasks you must do.
  • As an example, when you are to create a student you should create an object of the type of the student class you defined, enter all the relevent information into that object, and then add that object into the ArrayList.  Ditto on the courses.
  • Finding a student by id number will require you to go through the ArrayList of students one at a time, cast each element to type of your student class, and check the id number against the one you're looking for.

** End of the new notes from 4/27/04

When Bill Gates went to high school, there was a computer at his school.  In the early 1970s this was very very unusual.  He, being a person who actually knew how to program it, was called upon to work on the class scheduling software, a duty he eagerly accepted.  For some odd reason when the course schedules came out, somehow Bill Gates was always in the classes with the cutest girls..  Go figure. (yeah, this did happen)

Now it is your turn!  With luck this project will be your first step toward a life of riches and scheduling malfeasance.  You are to write a program to schedule students for classes. 

Your program needs to be able to do the following:
Define a class, you need to be able to have the user enter information about a class, such as name, size, period, and teacher.
Define a student, you need to be able to have the user enter information about a student such as their name, their age, and their id number
Assign a student to a class, you need to be able to place a student into a class (ask the user for the student's id number, and then display a list of all classes available, and have the user select the one they want).  Be sure that the program will not allow the user to assign a student to a class that has a period that the student is already enrolled in a class.
Print a course roster, where the program prints the names of all students to the screen.

Your program should have a menu where the user can select any of those options or select to quit the program, and once a task is completed (except for quitting the program) it should return the user to the menu.  You will need to define a class for classes, and one for a student.  You should keep an ArrayList of Students and of Classes.  This need not be a GUI program, and it is up to you to decide what the best way to get input from the user is (JOptionPane or System.in are probably the easiest)
You also have to make sure to handle errors.  You should reprompt the user if they enter in anything that is invalid (especially input that generates exceptions!)

Your program is due on 4/28/04, and is worth 20 points.  This is an individual project.

Project 4 - Marine Biology Case Study: A Second Project

Modify the SimpleMBSDemo1 class in the project to setup a 100x100 grid, and place 30 fish on it.  10 of the fish should move only occasionally.  Extend the fish class to have a different move method where they only move 50% of the time for those 10.  (use the Random class)   10 of them should pick random locations on the board to teleport to.  For those, extend the fish class again, once again replacing the move method with a new one that moves to entirely random locations on the board (but only move if there are no other fish in the location).  For the remaining 10 fishes, they should randomly change their colors.  Extend again the fish class this time making a new move that changes mycolor every time a move is made.

Hints:  In your extended fish classes, you need to create the following constructor:

public nameofyourextendedclass(Environment myenv, Location l) {
    super(myenv,l);
}

this defines a constructor that wants an environment object and a location and will call the superclasses' constructor (built into Fish)
If you get compiler errors complaining that Fish() does not exist after this, add a method into the Fish class as follows:

public Fish() {
}

This is an individual lab and worth 20 points.  This is due on Friday, April 9 (or Friday April 16th if you are at Peninsula) at the start of class.

Project 3 - Marine Biology Case Study: A first project

Part 1 - Due at the end of class on March 26 (the plan of action)  Worth 6 points.
Part 2 - Due at the start of class on March 31 (the working modified code demoed to the teacher) Worth 16 points.  (graded out of 14 points)

Register (you do NOT need to provide a valid email address) at the Java/Case Study Tutorial website.
The process has changed, and now registrations must be completed by a teacher.  (I am making this change in case anyone else ever looks here so they will not be confused by the incorrect information)

Run the tutorial for the Java Marine Biology Case Study to learn what the case study is and how it works.  Given that information, you need to come up with a strategy for how to solve the following problem:

Fish need to be able to eat, but they should not eat too much due to obesity and all.  Define 4 board places on the board that contain food, and add information to the fish to store how much food they have had.  Start them off 50 levels of food, and every time they swim through a fooded spot, they should increase the amount of food they hold by 10 units.  Every time they swim and do not touch food, they should lose a unit of food.  If the fish has no food, or has over 100 food units, they should "die" (meaning that they are no longer allowed to swim)

This is an individual project and will most likely need to be done at least partly at home.  You can get instructions on how to download the Marine Biology case study files here, and instructions on how to set it up for BlueJ here (download the package for a ready-made all-in-one-project version)

If you wish to implement extra extensions for extra credit, please ask Mr. Casaburi in advance for clearance so you ensure you will recieve the credit for it.

Project 2 - Will be graded on March 2, 2004 at the start of lab

Implement a Minesweeper game application from the given template (note: if you wish not to use the game template and write the code from scratch, that is allowed this time)

This project can be done in groups of no more than 2 people.  Note: For groups, you MUST specify whom did what.  The project is worth a total of 22 points, it will be considered out of 20 points, but groups can earn more than that.  For chapter 10, the project will serve as both the lab and homework component of the grade)

Demo version of the finished "game"

Template code to start from for minesweeper.java

Template code to start from for gridposition.java

You are responsible for implementing the following methods in minesweeper.java:
assignmines  (worth 4 points)
click (worth 4 points)
updatescore (worth 2.5 points)
lose (worth 2.5 points)
win (worth 2.5 points)
and the actionPerformed method in the nested gridclick class (worth 2.5 points)

You are responsible for implementing the following methods in gridposition.java
countmines (worth 4 points)

You must include sufficient comments, reasonable variable names, and work according to the specifications in order to recieve the maximum points each portion is worth.

If it is clear that the effort put into the effort was severely lop-sided between two partners, points will be awarded accordingly.

Optional extensions available for extra credit (beyond the recursive click method to expose all blocks that should be exposed):
  • Handle right-clicks to mark mines as mines
  • Implement actual graphics and colors
  • Allow the game to be restarted without having to reload the program (put a button on the screen that starts a new game)
  • Allow the user to specify the # of mines, and the dimensions of the board with JTextFields
  • Track the amount of time it takes a user to solve the puzzle (and display it to the user)
  • Implement a hidden "cheat" to expose the board if the user knows the secret.  (this is VERY open-ended)
To figure out how to do these, READ THE BOOK and search online or in other books.  All information exists, and figuring out how to find it out on your own is one of the most important skills good programmers learn.

These extensions are to be checked off on the same day as the program.  You will need to explain them, and cite who did what for them.  Each one is worth either 1 or 2 points depending on how well they are implemented, and how well documented they are. 


Project 1 - Due on Jan 13, 2004 (at the start of class)

Implement a Tic-Tac-Toe game applet from a given template

This project can be done in groups of no more than 2 people.  Note:  For groups you MUST specify whom did what.  The project is worth a total of 22 points, it will be considered out of 20 points but groups can earn more than that. (for chapter 8, the project will serve as both the lab and homework component of the grade)

Demo version of the finished "game"

Template code to start from

In the template code there are 12 parts (numbered 0 through 11).  Each one is designated by // *** and describes what you need to modify and/or implement. 

The checkpoints that you have are as follows:
If you have completed parts 0-4 by Wednesday Jan 7 (during class) to the teacher's satisfaction your group will recieve 2 extra points.
If you have completed parts 5-9 by Friday Jan 9 (during class) to the teacher's satisfaction your group will recieve 2 extra points.

You must include sufficient comments, reasonable variable names, and work according to the specifications.  All parts are worth 2 points, except for 0 and 1 which are both worth a single point each.  You can include further changes to the code in order to complete the assignment, but you must specify the changes, and there should be a compelling reason for the change.  The code that exists.

Optional projects (for extra credit!) to be done individually ONLY  (I will not grant credit for these extensions or projects done in groups)  All projects are due on Jan 15, 2004.   In addition, you are free to pursue as many of these as you wish. 

Implement a mastermind game as a Java applet.  Consult with the actual game for the full game rules (worth anywhere from 5-10 points)

Implement a game engine for the finished tic-tac-toe program that has the computer act as player 2, and thus take turns in your place.  The more sophisticated the decision making, the more points this will be awarded.  (worth from 2-5 points)

Implement a tic-tac-toe game that works correctly in a 5x5 grid or a 3D tic-tac toe game (where there are 3 grids of 3x3) (worth between 2 and 5 points)

Implement a partial battleship game showing one person's side of the game.  Have the computer randomly place the ships.  Consult with the actual game for the rules. (worth between 5 and 8 points)

Additional projects are possible, but only if the teacher approves IN ADVANCE.



last updated on 10/26/04
Copyright (C) 2004 Jim Casaburi