Intro to Java Programming

Course Home
Syllabus
Announcements
Reflections


Related Links

Announcements

November 18, 2017

Session Finale

Congratulations! You made it to the last day of the session! Below is the agenda for today.

Get Ready for EXPO: Bouncy Colored Balls

Everyone should have a version of Bouncy Colored Balls to show for EXPO. If you didn't send me your Bouncy Colored Balls project, you will need to recover or reconstruct the work you've done so far.

Below are the steps needed to complete the Bouncy Colored Balls project, along with approximate times in the video when those steps are discussed. You can use the steps as a guide in case you're not sure where you left off in the video:

  1. Create new project with World, MyWorld and Actor classes (02:04)
  2. Create a Ball class with a button image. (03:24)
  3. Add code to act method to move. (04:23)
  4. Add code to act method to turn if atWorldEdge (04:29)
  5. Copy atWorldEdge method from Animal class into Ball class. (05:00). Since most people haven't done trick-the-turtle, you'll need to Edit -> Import Class... and select the Animal class to get the code for atWorldEdge. If you need help with this, ask a friend. Most students did this last week.
  6. Add addObject statement to MyWorld constructor to add a new Ball at (300, 200). (07:16)
  7. Add a default contructor to the Ball class. (07:58)
  8. Change the MyWorld constructor to pass new Ball() an argument of 180. Note: won't compile until you complete next step. (10:36)
  9. Change the Ball constructor to accept a parameter called direction and sets rotation appropriately. (10:53)
  10. Change the MyWorld constructor to pass new Ball() a random number. (12:34)
  11. Add a second constructor to the Ball class that accepts no parameters and sets rotation to 270. (15:23)
  12. Prepare to add a field for the button image by adding the five button images to the Ball class with set image... (16:37)
  13. Change the names of the button image files that have been stored in the images folder of your project to button-0.png through button-4.png (17:49)
  14. Create a field in the Ball class called imageNumber to store the number for the image (19:26)
  15. Get rid of the default constructor (20:04)
  16. Initialize the imageNumber field to 0. (20:10)
  17. Add a call to changeImage() in the if block in the act method of the Ball class. Note: won't compile until after next step. (20:50)
  18. Add the definition for the changeImage method to the Ball class. (20:57)
  19. Fix the runtime error in the definition of changeImage in the Ball class. (24:40, 27:03)

After you've completed steps 1-10, you should do ALL of the following:

  1. Have your work checked by another student
  2. Have your work checked by a TA or your instructor
  3. Compress and send your project to TJ.
  4. Copy the project before you move you move on to steps 11-19.

Some of you went beyond step 10 last week and sent me your work. Unless I tell you otherwise, you can just continue from where you left off last week.

Once you have finished steps 1-10 or more, you can do any of the following:

  • Finish Joy of Code #17.
  • Continue with Joy of Code. Videos 17-23 are all about bouncy colored balls.
  • Work on any other project you want to show for EXPO.
  • Create a Quizlet or Kahoot that uses material from any of our Quizlet flash cards.

Where Was I?

If you can't remember where you left off last week, here's some help:

  • Download your project from your Sent Mail. If you didn't mail me (or anyone else) your project last week, it won't be in your Sent Mail. Ask for help to recover or reconstruct what you did last week.
  • Go to the Joy of Code #17 video from last week and pick up where you left off. Use the controls at the bottom of the video to scroll to the frame where you left off.
  • If you can't remember where you were, check the list below.

Where To Start: AM Students

  • Aiden. Step 11 (15:23), or work on a different project you'd like to show for EXPO, or work on Quizlet or Kahoot.
  • Allen. I didn't receive your project last week. Recover or reconstruct. Talk to TJ or JeNai if you need help.
  • Charlie. You were absent last week. See me or a TA.
  • Eli. Step 11 (15:23) to construct the version shown in the video, or move on to Joy Of Code #18. Or work on a different project you'd like to show for EXPO, or work on Quizlet or Kahoot.
  • Elliot. Give the Ball an initial image as shown in Step 2 (03:24). Take another look at Step 7 (07:58) to see where the Ball constructor belongs. You will need to move it from the MyWorld class to the Ball class. You did steps 8 (10:36) and 9 (10:53) last week, but watch these to refresh before you move on.
  • Ethan. You didn't need to copy the act and atWorldEdge methods into helodarkes, since that class is a subclass of ball, which already has those same methods defined. It will be easier to follow the video going forward if you change the name of your ball class to Ball (with a capital B). We will get together with Jaiden, Lukacs, and Romir to make sure you guys get through Step 10 today. Check in with Jaiden and Lukacs to make sure they get their changes for Step 5 (adding the atWorldEdge method to the Ball class) correctly implemented before we move on as a group (you, Jaden, Lukacs, and Romir) to Step 6 (07:16).
  • Ian. I didn't get your bouncy colored balls project last week. Recover or reconstruct what you did. Talk to TJ or JeNai if you need help.
  • Jaiden. Check in with Ethan or Romir to finish your implementation of Step 5 (adding atWorldEdge to the Ball class). Then you, Ethan, Lukacs, and Romir can work with me on Steps 6-10 (07:16).
  • Lukacs. You need another closing brace to finish Step 5 (adding atWorldEdge to the Ball class). Check in with Ethan or Romir to complete this step. After that, You, Ethan, Jaden, and Romir can work with me on Steps 6-10 (07:16).
  • Maria. You didn't send a project last time. Recover or reconstruct what you did last week. Talk to TJ or JeNai if you need help.
  • Max. Step 12 (16:37), or work on a different project you'd like to show for EXPO, or work on Quizlet or Kahoot.
  • Michael. Watch Joy Of Code #19 if you haven't had a chance to see it. Next is Joy Of Code #20. The bouncy ball scenario goes through Joy Of Code #23, if you have time to follow it all the way through.
  • Nicholas. We'll find a spot for you to watch Joy Of Code #17 without distraction and then work with you to get your project together for EXPO.
  • Romir. We will get together with Ethan, Jaiden, and Lukacs to make sure you guys get through Step 10 today. Check in with Jaiden and Lukacs to make sure they get their changes for Step 5 (adding the atWorldEdge method to the Ball class) correctly implemented before we move on as a group (you, Ethan, Jaden, and Lukacs) to Step 6 (07:16).

Where To Start: PM Students

  • Alice. Step 12 (16:37). There should just be one Ball class that can take on five different images. Or get together with Sofia and Nuha to get Nuha through Step 10, and then you guys can work on your EXPO project.
  • Axell. See how to add the blue button image to your Ball class at (03:24), then review Step 9 to see where the Ball constructor goes. You'll need to move it from your MyWorld class to your Ball class. After that, proceed to Step 10 (12:34).
  • Cross. You were absent last week when we work on Joy of Code #17. See me or a TA to get started.
  • Darius. See me to touch bases on "eat and chase game of hamburgers" and talk about Joy of Code #17.
  • Hamza. I didn't receive your project last week. Recover or reconstruct. Talk to TJ or a TA if you need help.
  • Nelson. Watch the rest of the Joy of Code #17 video starting from Step 12 (16:37) and do as much as you can. Or work on making a Quizlet or Kahoot based on material we've covered.
  • Nuha. Your Ball class has your act method and Ball constructor in the same yellow rectangle. Check in with Alice or Sofia to see how this should look. After this problem is fixed, you can move on to Step 8 (10:36). Once you have made it through Step 10 (12:34), you can continue with Joy of Code #17 or work on the EXPO project you planned with Alice and Sofia.
  • Sofia. You can continue with Joy of Code #17 starting with Step 11 (15:23), or help Nuha get through Step 10 and then work on the project that you and Alice and Nuha planned for EXPO.
  • Toby. I didn't receive your project last week. Recover or reconstruct. Talk to TJ or a TA if you need help.

Celebrate

As time allows, we can spend some time playing games made with Greenfoot, and maybe see a fun video or two before EXPO begins.

EXPO

Show off the cool work you've done these past eight weeks!

November 11, 2017

Fields and Constructors

To get ready for our hack-a-thon, we'll take a closer look at the fields and constructors we saw in FatCat.

Review Quiz

Another thing we'll need for hack-a-thon is a good handle on the material we've already covered. Take this quiz. If you get more than one wrong, we'll make time for you to go over the material and give you a chance to retake it as needed.

Hack-a-thon

For today's hack-a-thon, we'll through the JoC #17: Bouncy coloured balls lesson from the Joy of Code videos. This video will show you how to create a Greenfoot project from scratch.

When you're finished

When you complete JoC #17, you can move on to the next video, JoC #18. It's a short one, but a cool one. It shows you how to make bouncy balls appear with mouse clicks!

Make sure you send me your completed bouncy balls project.

November 4, 2017

EXPO!

EXPO! will be on November 18. Parents can come into the classroom 15 minutes before the end of class so you can show them the work you've done. You can show any work you like, include your pair programming work, projects you built watching Joy of Code, your own programming creations, or work you've done with Quizlet or Kahoot!

Quizlet Review

We'll review the Quizlet from last week to prepare for Quizlet Live and pair programming.

Method Headers Pair Programming

Work through this google doc on reading documentation as part of your preparation for work with FatCat.

Video Lessons

Before you begin these lessons, be sure to log out of PlayPosit.com

You can also play around with FatCat.

A Closer Look

Next, we'll take a closer look at FatCat together.

Independent work period

Independent work period begins when you and your partner are finished with pair programming. During this time, you can:

  • Put on some headphones and do some Joy of Code lessons.
  • Go over the Quizlet cards to get ready for another Quizlet Live
  • Make up your own Quizlet or Kahoot! cards on any of the Java material we've talked about in class.
  • Make a game of your own design.

October 28, 2017

Managing email

Many of you are new email users. If you need help blocking unwanted email or changing your email password, let me know. If you suspect that someone else is using your account without your permission, it would be a good idea to change your password, and make sure you log out of your account before you leave class.

Video lessons

These video lessons include questions to check your understanding. Recalling information from the videos in this way helps students learn the material better. You will need to wear headphones for this work.

Independent work period

Independent work period begins when you and your partner are finished with pair programming. During this time, you can:

  • Put on some headphones and do some Joy of Code lessons.
  • Go over the Quizlet cards to get ready for another Quizlet Live
  • Make up your own Quizlet or Kahoot! cards on any of the Java material we've talked about in class.
  • Make a game of your own design.

Today's Quizlet

If we have time, we'll also do Quizlet.live with the Quizlet set from last week.

October 21, 2017

Today we have a new Quizlet:

Pair Programming: How to access one object from another

Today's pair programming answers the question:

How can I update the score counter whenever an asteroid is destroyed by the rocket?

Don't forget to save your work when you're done. You can compress your project folder and email it to your partner and your instructor.

Independent work period

Independent work period begins when you and your partner are finished with pair programming. During this time, you can:

  • Put on some headphones and do some Joy of Code lessons.
  • Go over the Quizlet cards from last week to get ready for another Quizlet Live
  • Make up your own Quizlet or Kahoot! cards on any of the Java material we've talked about in class.
  • Make a game of your own design.

October 14, 2017

Last week, we talked about methods like getX() that have a return type:

We use these methods when we want to get information.

Other methods that return int values include getY(), getWidth(), and getHeight(). Since these methods return int values, you can use them anywhere you can use int values. For example, you can write things like:

  • getX() ≤ 5
  • getY() ≥ getWorld().getHeight() - 5

The method call getWorld().getHeight() is a special kind of call to get information from the world object. We'll talk more about accessing the world object and other objects when we get to the tutorial called "How to access one object from another".

In today's pair programming, we're going to use a method called Greenfoot.getRandomNumber() to make a lobster move around randomly in an attempt to catch the crab. There are two important things to notice about this method:

  1. Greenfoot.getRandomNumber() is a static method. That means it belongs to a class, not an object. Static methods generally need to be called with the name of class they belong to. The Greenfoot.getRandomNumber() method belongs to the Greenfoot class.
  2. The Greenfoot.getRandomNumber() method needs an argument. The argument needs to be an integer. For example, if you make a method call Greenfoot.getRandomNumber(10) you will get a random number between 0 and 9. In other words, you will get one of these ten numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9.

Like all methods that have an int return type, you can use Greenfoot.getRandomNumber() anyplace you can use an integer. For example, you can use expressions like:

  • move(Greenfoot.getRandomNumber(10))
  • turn(Greenfoot.getRandomNumber(90))
  • Greenfoot.getRandomNumber(100) < 10

The driver will need to download this starter code.

The navigator will read from this documentation page.

What do I do when I'm done?

When you finish pair programming, you can:

  • Put on some headphones and do some Joy of Code lessons.
  • Go over the Quizlet cards from last week to get ready for another Quizlet Live
  • Make up your own Quizlet or Kahoot! cards on any of the Java material we've talked about in class.
  • Make a game of your own design.

October 7, 2017

To start things off, we'll make sure everyone is set up with email you can use for saving your work and writing reflections.

Next we will review Tutorial 3 from last week's crab scenario and discuss these terms:

  • class: "cookie cutter" for creating objects
  • object: instance of a class. Many can be created from one class.
  • method: action an object can perform after it has been created.
  • act method: special method invoked once with the Act button and repeatedly by the Run button.
  • instance: another word for object
  • return value: value returned by a method with a non-void return type. For example, the return value of getX() is an integer that tells us the x-coordinate of an actor.
  • return type: Kind of information returned by a method. For example, getX() has a return type of int, since it's an integer. Methods that return true or false have a return type of boolean.
  • void return type: defines a method that doesn't return a value. methods with this return type are like commands. Methods that return values are more like questions.
  • int return type: Methods with int return types are for asking questions that can be answered with a number. For example, getRandomNumber(100) or getY().
  • boolean return type: Methods with boolean return types are for asking questions that can be answered with true or false. For example, isAtEdge().
  • method call: a request sent to an object. If the method has a void return type, the request is like giving a command. If the method has a non-void return type, the request is like asking a question.
  • argument: information passed to a method. For example, when the method call move(4) is made, the information passed is the integer 4.

Then we'll do our first Quizlet Live on classes, objects and return types based on the quizlet below.

After Quizlet Live, you'll be ready to this quiz.

When you're done with the quiz, the Joy of Code page is available to help you do some self-paced work.

Headphones will be made available so you can work through video lessons and try out sound effects without disturbing others.

Pair Programming

If we have time, we'll make random pairs and do some pair programming. We'll pick up with the version of modern crab that was created in today's demo

September 30, 2016

Welcome to Intro to Java Programming: Building & Enhancing Games! Here's what we'll do today:

  • Complete this background survey.
  • Get to know each other.
  • Discuss why we need special languages to communicate with computers.
  • Learn to program a wombat.
  • Learn about pair programming.
  • Use pair programming to start work on a crab game.
  • Writing a short reflection and sending it to tj@tjleone.com (I'll explain reflections later today).

In Between Times

If you've completed your survey, check out the Joy of Code Lessons to learn more about game-building with Java and Greenfoot. To watch the videos, you can ask for headphones or use your own headphones or earbuds if you brought them. If you've already worked with Greenfoot and would like to start on a game of your own, go for it!

At Home

Here are some things you might want to do at home:

  • Download and install Greenfoot on your home computer. Instructions for this are in JoC#2
  • Right click on the Hedgehog class in the Class Diagram. Select Set Image... How do you change the Hedgehog's image?
  • Download some sample projects ( ants, asteroids, fatcat, little-crab, marbles, piano, wave, wombats) and play around with them.

This web page was created to supplement a course offered by The Center for Talent Development. CTD This work is licensed under a Creative Commons Attribution 3.0 Unported License. Creative Commons License Terms of Use. Privacy Policy.