Having trouble with the GUI?

Oct. 30, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

Some of you have complained about getting a Null Pointer Exception when trying to set a color on a "brush," like this:

Graphics brush = pnlSimulation.getGraphics();
brush.setColor(Color.BLUE);

That second statement will generate an error if you attempted to execute it before pnlSimulation is displayable. To correct the error, make sure that:

  • pnlSimulation is added to the content pane -- for example, with c.add(pnlSimulation, BorderLayout.CENTER())
  • the window is visible -- with this.setVisible(true);
Both of these conditions must be met before attempting to use the graphics for pnlSimulation.

Test 2 Coverage

Oct. 28, 2009

Posted by PERRY, JO under Information
2 Comments | Permalink

Test 2 will be given on campus  in EB2 Room 1228 on Wednesday, November 4 at 6 pm. You will be allowed 75 minutes to complete the test. If you are taking the test off campus, you should arrange a time to take it next week with your proctor.

The test will cover all the material mentioned in the schedule through the week  of October 19 21. The test format is similar to the previous test with fill in the blanks, short answer, short coding, and some method definitions. The approximate question breakdown is:

  • 5 points. Javadoc
  • 20 points. Software development process, design, UML 
  • 40 points. Inheritance and interfaces
  • 22 points. GUIs
  • 13 points. Linked Lists

Project 1 Grades Posted

Oct. 17, 2009

Posted by TETTERTON, JAMES under Information
0 Comments | Permalink

I have posted project 1 grades.  You can find your grades in the gradebook.  I have also uploaded a text version of the gradesheet.  A link labeled 'Retrieve Assignment' will appears on http://courses.ncsu.edu/csc216/, or you can use submit.ncsu.edu. 

Project 2: Simulation runs

Oct. 14, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

When you run a simulation, make sure that you do the task in each step in the correct order. This is the logic that I used:

for each step of the simulation
get the count for predator, prey, scavenger

plot all of the counts on the graph

get the projected population for predator
get the projected population for prey
get the projected population for scavenger

set the predator count with the value just retrived (from the projected population)
set the prey count with the value just retrieved
set the scavenger count with the value just retrieved

It is important to get each projected population before setting any count.  Make sure you understand why.

Project 2 -- correction in population factor descriptions

Oct. 12, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

In the original version of Project 2, the population growth factors for the scavenger were incorrectly listed in the table that was part of the simulation requirements. That has been fixed in the current version. Make sure that your equation for calculating changes in scavenger populations is correct. So, using x for prey, y for predator, and z for scavenger counts, the growth factors should be treated so:

  • The growth factor from scavenging corpses of killed prey should be multiplied by x, y, and z.
  • The growth factor from scavenging corpses of prey that died natural deaths should be multiplied by x and z.
  • The growth factor from scavenging corpses of predators should be multiplied by y and z.

Project 2: registerPredator() and registerPrey()

Oct. 07, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

The Animal class declares two abstract methods: registerPredator() and registerPrey(). Here is why.

Each Animal in the simulation ecosystem must be associated with a concrete Predator or Prey. But when you create an instance of Predator, no instance of Prey may yet exist. At some time, you have to decide which species (which instance) is is going to be the prey for the instance of Predator you just created. So suppose you create coyote as an instance of Predator and later create mouse as an instance of Prey. Then this statement determines that mouse is prey for the coyote:

coyote.registerPrey(mouse);

Similarly, you want to do this for mouse:

mouse.registerPredator(coyote);

registerPredator() registerPrey() are setter methods with the prefix "register" instead of "set."

Project 2 -- officially posted

Oct. 02, 2009

Posted by PERRY, JO under Information
3 Comments | Permalink

I have posted Project 2 and linked it to the schedule and the project page. This project requires that you:

  1. Understand abstract classes. interfaces, inheritance, and polymorphism.
    You must use an interface that we provide, and you must code a class hierarchy in which the base class is abstract.
  2. Construct a GUI from scratch.
    You should understand the lecture notes on GUIs before attempting the user interface for the project. There are numerous hints on constructing parts of the user interface in the project writeup. But don't be surprised if you have to go to the web to find additional information!

Test 1 Grades Posted

Oct. 01, 2009

Posted by TETTERTON, JAMES under Information
0 Comments | Permalink

If you took the test with Dr. Perry and myself your grades have been posted in Gradebook.  I have not received any remote test as of yet.  Once I receive all tests I will turn them over to the DE department to be scanned and email your graded test back to you.

 A link to the Gradebook will appear here http://courses.ncsu.edu/csc216/

Test 1 Coverage

Sep. 22, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

Your first test is next week. Those taking the test with a proctor can take the test any time from Monday through Friday afternoon. Those taking the test on campus should come to EB2 Room 1228 on Wednesday. Sept 30 at 6 pm. You will be allowed 75 minutes to complete the test.

The test will cover all the material mentioned in the schedule through the week Sept 21, 23. (There will be no questions on Composition, however.) The question format includes fill in the blanks, short answer, and short coding. The approximate breakdown for questions is:

  • 20 points:  Basics (Java & Java VM through Class Methods & Variables)
  • 15 points: Strings, StringBuffers, Scanners, tokenizing
  • 14 points: Testing, including JUnit testing
  • 4 points: UML, Design
  • 5 points: Javadoc
  • 42 points: Array-based lists


Away from email for a few days

Sep. 22, 2009

Posted by TETTERTON, JAMES under Information
1 Comments | Permalink

I'm in the process of moving to a new house.  I will not have account to email tomorrow through Saturday.  Please send email to both Dr. Perry and myself for the fastest reply to your questions.

Coordinating chapters from edition 2 and edition 3 of the textbook

Sep. 16, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

Some students in the class have edition 3 of the textbook while others have edition 2. The chapter listings on the schedule page are all in reference to edition 2. If you have edition 3, you can translate to the corresponding reading material from edition 2 through a website that the author provides: http://www.horstmann.com/bigj2/ConversionGuide.html

Completing the third full week of the semester

Sep. 10, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

We are almost entering the fourth full week of the semester. By this time, you should have:

  • Completed the first 5 exercises.
  • Carefully read all lessons at least through Arrays as Data Buffers. Unless you are a couple of days behind, you should have read through Unit Testing with JUnit.
  • Listened to/watched the taped lectures corresponding to any of the topics of the lessons.
  • Started real work on the first project.

Eclipse and Mac OS X 10.6 (Snow Leopard)

Sep. 01, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

Mac users: Your Eclipse installation might break under OS X 10.6. If it does, you'll need to update your Eclipse  to the Cocoa 64-bit version (Galileo). Point the new installation to your existing workspace.

 Click here to get the correct Eclipse download page.

 Many thanks to Timothy Striplin, one of your fellow students, for pointing this out!

Project 1

Aug. 24, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

The first programming project has been posted. It is due a little over a month from now (September 27). While that might seem like a wonderfully long time away, it's not.

The project requires that you read and understand a substantial amount of code (understand it at least enough to be able to use it). With less than one week into the semester, is there anything you can start on now? YES. Start coding the Passenger class -- most of it is pretty simple and straightforward. The only subtle part is writing a method that parses Passenger information out of a string.

Welcome to the CSC 216 blog

Aug. 18, 2009

Posted by PERRY, JO under Information
0 Comments | Permalink

Welcome to CSC 216, Programming Concepts in Java. This course officially begins on Wednesday, August 19.

The purpose of this blog is to provide in-depth class discussion or announcements. We will use Twitter for short comments/

In order to post an entry to this bloc, you must:

  1. Register with the NCSU libraries as a blogger.
  2. Email me your user name and request permission to be a blog author. Author posts are always identified by Unity ID.

If you want us to post an entry for you (thus keeping your Unity ID private), please email it to either James or me and we'll take care of it.

The url for the class website is: http://courses.ncsu.edu/csc216/lec/601/