December 10, 2011

Thanks all to those who submitted their Assignment 6s. As stated in tutorial, the marking scheme will be (out of 10 marks): 2: JAR attempted 4: JAR runs 6: JAR runs with resources appropriately handled 8: Applet attempted (and JAR is in good shape) 10: Applet successfully deployed

Part marks will be awarded at my discretion.

Good luck on exams!

December 7, 2011

Anybody looking to complete Assignment 6 may want to check out Chapter 10 of Core Java. It's a great resource for what you have to have accomplished.

December 1, 2011

GOOD NEWS, EVERYONE! (No, this IS really good news)

The deadline for Assignment 5 has been moved to Monday December 5, at 11 pm.


November 16, 2011

You may want to look at EventObject, ActionEvent or AWTEvent as base classes for your ColumnClickedEvent. Just saying.

There seems to be some confusion as to which events need to be handled here. What's going to happen is:

1. Button is physically clicked 2. GUI takes note of this somehow (perhaps the Button has listeners attached to it?) and creates a new ColumnClickedEvent. 3. The new event gets passed to all the ColumnClickedListeners which the GUI knows about. Possibly done using a method which is specified in the design. 4. The ColumnClickedListener(s) then have their three tasks to do: print to the console, create a new board, create new piles of disks which have been set aside.

November 7, 2011

One of the best Swing references online is Oracle/Sun's online tutorial. You will probably want to refer to it constantly as you work on your next tutorial exercise/assignment. Your Core Java book will also be very useful.

Creating Swing components manually can seem like a lot of work - my advice is to compile/test frequently (i.e. after you add one or two lines). There are numerous visual Swing editors available online, some of which are free.

Some of these are compatible with Eclipse, but I am unable to get them installed on our Linux workstations. You may use these on your own machines to create your GUIs, but the resulting generated code must run on the Linux workstations.

Another IDE called NetBeans has a built-in visual Swing editor, but please be warned that once generated, this code may not be edited within the IDE.

Because the example I will show you in this week's tutorials is quite similar to the tutorial example/assignment which you are to complete, I will not be making my code available online.

November 2, 2011

Those of you who are using packages will have to preserve your directory structure for your submission when the time comes. The easiest way to do this is to use the tar command.

Ensure that you HAVE CLEANED UP your packages (so no class files, no backup files, nothing that you don't want to include). From the parent directory of your two packages (in this example pop10game and pop10tests), you can use the following command:

tar -cvf <name of tar file>.tar pop10game pop10tests

The syntax of the command means that you put the name of your tarfile first, followed by a listing of any files/folders you want included The command is recursive, meaning that the contents of any folders you include will also be put into the tarfile.

You can also use tar -tvf <name of tar file>.tar to check on the contents of your tar file afterwards. If you think your tarfile is too large, you may use the gzip command to compress your tarfile before submission.

You may also submit a README file (which describes how to compile your program and how to run it from the console), either separately, or as part of your tarfile.

For those of you who are in the process of learning Eclipse, Safari has a number of good books about Eclipse pitched for different levels. You may find some of these very helpful as you begin to become more accustomed to using an IDE. (I should also note that there are also some great books online about emacs, vi, Linux, and any number of other things on there... definitely worth exploring!).

November 1, 2011

For those of you interested in learning more about package management, your Core Java book has a very good discussion of it at about page 150. Take a look!

October 27, 2011

Feedback and marks for Assignment 2 have been sent out/posted to Blackboard. I should also note that the final exam schedule has been posted - you'll need to check your Student Centre to see what yours resembles.

October 25, 2011

Make sure you have your test cases from Assignment 2 running for this week's tutorial exercise. I recommend making sure you complete this week's exercise since it is required for Assignment 3, anyways.

October 19, 2011

You can read through this for a fairly good introduction to Javadocs. What's the most important is that you have header blocks for your non-trivial functions, stating what the function signature, parameters and return values are.

October 17, 2011

As a reminder, an additional TA with slightly later CT hours is available to help you on weeks when assignments are due. Stop in and say hi to him, at least!

His schedule is here.

To complete the code for for your Pop10Player class, you will need to know how to use random numbers. Here's a quick summary of what you need to do:

// import the class that gets you the random number code
import java.util.Random;
// stuff...

int getANumberBetween0and5()
  // define a constant for our upper bound
  // we never want the result to be as big as 6
   int UPPER_LIMIT = 6

    // instantiate a random number generator; default seed is current time
    Random myRandom = new Random();

   // get a random number
   int MyRandomInt = myRandom.nextInt();

  // make sure the random number is positive and is in the correct range
  return Math.abs(myRandomInt) % UPPER_LIMIT;

  // you can also do this (instead of the previous two lines):
  // return myRandom.nextInt(UPPER_LIMIT);

October 13, 2011

Further testing (hah!) has revealed my Fraction.java.reduced code to be buggy. An updated version is now available here.
Marks for Assignment 1 have been posted to Blackboard and the breakdown of the marks have been emailed to each of you. If you are missing either, please let me know ASAP. If you have any questions or would like to go through your assignment in more detail, please email me or come visit me during CT.

October 12, 2011

Some clarifying remarks:
1) You should be able to download the Fraction.java.reduced file without issues now.
2) What you really want to do with this exercise is determine a set of expected values given some arithmetic operations using Fractions. Then you compare the result you get from using the Fraction class to your expected values, and see if they're the same.
3) If you're having trouble comparing Fractions, you may have to determine whether the members are the same, or alternately, look at how to compare Strings (remember you have a String representation in toString()) in Java

October 10, 2011

This week's tutorial exercise is on testing. I will provide the code you will test, and you will be required to write your own test suite.

October 5, 2011

Here is a pretty good tutorial on exceptions for those of you who are curious.

October 4, 2011

If you're getting stuck on this assignment, remember it's better to start with the less complex functions first. Save your work often, and test small changes lots rather than trying to test everything all at once.

You will be using the submit command on the Linux workstations to submit your work to me. The command you will use is
submit -c 233 -a 1

For more information on submit, you can use the command
man submit

Because you can only use submit from the Linux workstations (or other department machines), if you are using your own laptop or machine at home to work on the assignment, you must transfer your work to your CPSC account. USB key is ok, but you may also want to consider an FTP client such as FileZilla or a cloud data syncing service such as Dropbox.

October 2, 2011

Please come prepared to discuss Assignment 1 (which, by the way, is due Thursday, and which I hope you've started by now). The more questions you have, the more effective this week's tutorials will be.

September 26, 2011

You can find the code for the third tutorial exercise here now.

September 25, 2011

A sample solution for the first tutorial exercise is posted here.

You can find the code for the third tutorial exercise here when I post it in the morning.

September 17, 2011

Ready for tutorial? Please be sure you have your CPSC account credentials (a login and password) BEFORE you come to tutorial. You can check out this page if you are unsure about what to do.

You can find the code for the first tutorial exercise here.

September 10, 2011

Setting up this page. I will keep this page updated with news for both T01 and T02 during this semester.