The Object project

Creating a Java version of a material object--and share it!

Put your skills to good use by choosing an object that has some interesting behavior that you'd like to model (guitars, calculators, etc.), plan out your object, and then transform that plan into Java code!

Jump to a section

check_boxCore Project Tasks
local_diningObject Project "hamburger" guide
extensionConceptual Core: Object Modeling in Java
bookResources and reference documents

Project Phase Guides

object project phase diagram looks_onePhase 1: Choose an interesting, highly "modelable" object
looks_twoPhase 2: Create a written object plan
looks_3Phase 3: Translate object plan into Java code
looks_4Phase 4: Write a "testing class" with a main() method
looks_5Phase 5: Document & share your work

Core Project Tasks


Create a class diagram that represents the state (member variables) and functionality (methods) of a single physical object


Translate a class diagram into a Java class (or set of classes) that models the behavior of the planned object through command-line interaction and contains no main() method


Create a class with a main() method which creates an instance of the modeled object and demonstrates all of its functionality.fixed


Module Hamburger Guide

Printer-friendly Object Project Hamburger (*.pdf)

Editable Object Project Hamburger (open document text *.odt)



Module Learning Resources

Amazing gallery of past student object projects with building guides, code samples, screen shots, and commentary on class structure.

Class structure learning module: Reviews basic structure of any class in Java.



Conceptual Core: Object Modeling in Java

The object project is about designing two classes that work together:



Phase 1: Choose an interesting object

object project phase diagram

Brainstorm and choose to model an object that lends itself to being modeled in Java. As we know, Java classes are blueprints for objects, and those classes hold member variables and methods related to that object.

No good ideas yet? Explore the object project starter page for code and more discussion about object modeling.

Examples of solid object model ideas (click links to jump into the project seed page)

  1. Fog machine
  2. Fish tank
  3. A fish in that tank, or other animals
  4. A character in a game or story with special powers
  5. A bank or bank account
  6. A word game (hang man, test for reversibility, etc.)
  7. Electric guitar
  8. An Automated Teller Machine (ATM)
  9. Scoreboard or sports statistic generator
  10. A player of a particular sport

Examples of weaker object model ideas

  1. An entire video game
  2. A computer or computer-like device (mobile phones, game machines
  3. A computer screen
  4. An entire sport
  5. A rock, or any other mostly inert object that just sits there



Phase 2: Create a written object plan

object project phase diagram

Create a class diagram as we've done for weeks now that includes:

We have seen many such models in the course so far. Your class diagram should have these components, arranged in this order. You can be creative as long as it has the essential structure:

FogMachine class diagram with a helper class



Phase 3: Translate object plan into Java code

object project phase diagram

With a class diagram and some solid thought on your Object design, you're ready to code. Follow these guidelines as you do so:

  1. Create a package with an appropriate name. Inside that package, create two classes: one with your Object's name, such as Calculator. Create another class that will test that blueprint-like-class class by creating an instance of that object with the 'new' keyword. You can name this class something like CalculatorLand if your object is a Calculator.
  2. If you use code from any source other than your brain, please note those sources in your code as you go--Don't wait until the end of your project to try and add the citations later. Do it when you use it.
  3. Code your desired object in your class named that object (i.e. MissionControl). Create your member variables with appropriate types.
  4. Write the method declarations for each of your Object's methods. This means writing the method name, its access modifier, return types, and input parameters.
  5. Start coding the methods themselves after the structure looks good. Process the input parameter as needed, adjust member variables, and return the agreed value
  6. Add comments above every method and class describing what the method does or what the class represents
  7. Since your Object class is supposed to model an existing object, its variables and methods should NOT be declared static. We're making a new instance of your object, in which case the members and methods would no longer be considered static.



Phase 4: Write a "client class" with a main() method

object project phase diagram

Write a "client" class that makes and uses our object

Our client class, in this example the PartyLand class represents the larger application that uses our object. When we create an instance of a FogMachine with new and then use a FogMachine object by calling one of its methods, such as generateFog(), we are acting as the client of that object, This is represented in the analogy of a steel supply business which provides big, heavy stuff to its clients. Our object that we're modeling provides information to the class that calls its methods.

We can zoom into our PartyLand class and see how this is done.

FogMachine class diagram with a helper class

Phase Steps

  1. Create your client class with an appropriate name
  2. Compose a main() method in this class. In main, use the new keyword to create an instance of your modeled object. Store the reference that you receive from the object creation process (right side of the =) in an appropriately named variable.
  3. Using the dot (.) operator on your pointer variable to access the methods you wrote on your modeled object. Show the user what your object can do!



Phase 5: Eat Hamburger, prepare & share

object project phase diagram

Wrap up and share your work by following these steps precisely!


Step 1: Check and Comment

Check over your code and make sure you have commented each method by describing what that method does. Make a note of where you create an instance of your modeled object

Here is an example of creating a DisasterSite object in MissionControl class.

comments in java code


Step 2: Locate your package's source code directory

We are going to package up the following three items in a single directory, and then compress that entire directory for posting to the shared drive.

  1. Your package and source code (*.java files)
  2. A digital version of your class diagrams (for your blueprint object and the client class
  3. A screen shot of your program's output and user interaction

Open the Windows file explorer program

To find the source director for your PACKAGE you need to first find the directory for your entire PROJECT. This is inside the "NetBeans Projects" directory, which is stored in the Documents directory for your Windows user. Navigate to the following location:

Netbeans Projects / [your project name] / src / [your package name]

You should see at least two .java files in this directory. You'll save the screen shot and class diagram in here, with the .java files.

Leave this directory open in Windows Explorer so you can prepare your package for uploading in two steps.

Note this example of finding the .java files for DonutLand

comments in java code


Step 3: Capture and properly save a screen shot of your program's output

Run your program with various user inputs to show your Object working.

java output

Use the Snipping tool built into Microsoft Corporation's Windows 10 operating system (click the "start" button and search for "snipping"). Your snipping should look something like this (with different colors):

java output

Once you are happy with your clipping, save the image into the directory with your .java files!


Step 3: Create and/or just save a digital version of your class diagrams into the same directory as your screen shot and java files

Use any program you'd like: MS Word, draw.io google doc extension--anything--to create an accurate and pretty class diagram of both of your classes: The modeled object and the client class

Save this file into the same directory as your .java files and screen shot

At this point, you should have your package directory looking like this: with .java files, a screen capture of your output, and a file or two of your class diagrams.

java output


Step 4: Compress ("zip") your project directory

Check to make sure you have a package directory that contains your .java files, your screen shot, and your class diagrams.

We want to compress the entire package director, so navigate "up" one directory so that you can see the name of the directory that contains all your files. Then, right click that directory, select "send to", then "compressed (zipped) folder"

java output


Step 5: Rename your zipped directory precisely

Once you have a zipped directory from the previous step, right click the file >> rename and make sure your file name follows this pattern exactly:

[class section code]_[object name]_[first name and last initial]

java output

Note--don't include the [] -- replace the content with your correct data. Eric's sample file name is this:



Step 6: Upload the zipped file to our shared directory

Follow this link to our shared directory on the Microsoft Corporation's OneDrive

Upload your zipped project file to this shared drive. It should fit in with all the others and sort nicely

java output

When all is well, you should see your zipped file in the shared directory and it should be named like this:

java output


Step 7: Make an entry in our google drive log

Sharing requires some documentation. Open this shared google drive spreadsheet, find an empty row in your section's cunk of rows, and complete each column carefully.

saving to google spreadsheets

HURRAH! You're done!


Extension Question:

For those of you who like object design discussions, respond to this prompt on a separate paper and include it in your Object Project hamburger

You are pitching your object model to a group of developers who have volunteered to help you continue building your object into a full-fledged application. Respond to their question: “How is using Java’s object model an appropriate choice for for representing the material object you chose?” (Hand-write answer on paper and include in hamburger, or feel free to type, of course.)