Where Creativity & Education Meet Christianity

*This post may contain affiliate links, which means I may receive a small commission, at no cost to you, if you make a purchase through a link!*

Unit 5 – Writing Classes – in AP® Computer Science A is one of my absolute favorites to teach. I feel like this is where several things start to come together and the students feel like they are REALLY coding. But, I have found out that it seems to be where the confusion really starts to rear its ugly head. So, to help with the understanding and clear this confusion, I created an AP® Computer Science A project called “Class Creation Project: The Turkey Class“.

java class creation project - teachers pay teachers - tpt

The Objectives

In the Course Exam & Description document, there are several objectives for Unit 5 and this project hits several:

  • Mod-2.A – Designate access and visibility constraints to classes, data, constructors, and methods.
  • Mod-3.A – Designate private visibility of instance variables to encapsulate the attributes of an object.
  • Mod-2.B – Define instance variables for the attributes to be initialized through the constructors of a class.
  • Mod-2.D – Define behaviors of an object through non-void methods without parameters written in a class.
  • Mod-2.E – Define behaviors of an object through void methods with or without parameters written in a class.
  • Mod-2.F – Define behaviors of an object through non-void methods with parameters written in a class.

The Materials Needed

The Assignment

class definition for a unit 5 ap computer science a project - teachers pay teachers - tpt
The Turkey Class Definition

Students are to write an entire class definition representing a turkey. They must write the instance data, a default constructor, a parameterized constructor, three accessor methods, three mutator methods, and a toString method. The worksheet provided will have the class definition already sectioned out and will reinforce vocabulary, too.

Once the class definition is complete, they must fill in the driver program with the directions given of instantiating a turkey and using several methods to change the turkey.

The assignment takes roughly 90 minutes to do from start to finish.

The Fun Part

Once the students finish the class definition and driver program, I have them create a turkey from marshmallows, pretzel sticks, and jolly ranchers. This is the funnest part! The excitement on the students faces is so awesome to see!

They are to create it, name it, take a picture and upload it to Google Classroom. It is so cool to see the different turkeys they come up with!

The Product

Here is an example of what the students could make.

ap computer science a project for unit 5 - creating class definition from scratch in java - teachers pay teachers - tpt

The Conclusion

Do you have your students do something similar? If so, I am curious to know what.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

You may also like