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/