Can not Comple AP CompSci Program

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
lwhitehead@flinthill.org
Posts: 2
Joined: Mon Jan 28, 2008 2:36 pm

Can not Comple AP CompSci Program

Post by lwhitehead@flinthill.org »

I have a user who is teaching an AP Comp Sci class and is preparing for the AP exam. We can not seem to get the programs downloaded to compile. Has anyone heard of or seen anything similar?
User avatar
Nicholas Jordan
Posts: 124
Joined: Mon Dec 20, 2004 12:33 am
Location: Central Texas ISO Latin-1
Contact:

Re: Can not Comple AP CompSci Program

Post by Nicholas Jordan »

lwhitehead@flinthill.org wrote:...(snip)...We can not seem to get the programs downloaded to compile....(snip)....
There are a great number of problems that can affect comilation.

Let me ask:
  • What operating system.
  • College cs lab or business.
  • What programs are you trying to compile ?
lwhitehead@flinthill.org
Posts: 2
Joined: Mon Jan 28, 2008 2:36 pm

Post by lwhitehead@flinthill.org »

It is for a high school advanced placemnet exam.
The code is below:


/*
* AP(r) Computer Science GridWorld Case Study:
* Copyright(c) 2005-2006 Cay S. Horstmann (http://horstmann.com)
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* @author Cay Horstmann
*/

//import info.gridworld.actor.ActorWorld;
//import info.gridworld.actor.Bug;
//import info.gridworld.actor.Rock;

/**
* This class runs a world that contains a bug and a rock, added at random
* locations. Click on empty locations to add additional actors. Click on
* populated locations to invoke methods on their occupants. <br />
* To build your own worlds, define your own actors and a runner class. See the
* BoxBugRunner (in the boxBug folder) for an example. <br />
* This class is not tested on the AP CS A and AB exams.
*/
public class BugRunner
{
public static void main(String[] args)
{
ActorWorld world = new ActorWorld();
world.add(new Bug());
world.add(new Rock());
world.show();
}
}
User avatar
Nicholas Jordan
Posts: 124
Joined: Mon Dec 20, 2004 12:33 am
Location: Central Texas ISO Latin-1
Contact:

imports are wrong

Post by Nicholas Jordan »

Extremely good that you are using Horstmann, I will go look at the sources.

for now, you have your imports wrong:

import info.gridworld.actor.ActorWorld;
import info.gridworld.actor.Bug;
import info.gridworld.actor.Rock;

This is a very simple get-started type of program leading to http://en.wikipedia.org/wiki/Avant-garde ( avant-garde ) work at the leading edge of computer science.

See quote: "How to compile and run your first java program, from the java tutorial: java.sun.com" by agnul in post titled Java Script dated Mon Dec 17, 2007 1:57 pm

http://java.sun.com/docs/books/tutorial ... win32.html
User avatar
Nicholas Jordan
Posts: 124
Joined: Mon Dec 20, 2004 12:33 am
Location: Central Texas ISO Latin-1
Contact:

Had imports wrong.

Post by Nicholas Jordan »

I had the imports wrong - I edited them. Please show us any error messages the compiler is giving - the difficulty can be spotted much faster that way.
Post Reply