Questions tagged [acm-java-libraries]

The ACM Java Libraries were produced by the ACM's Java Task Force with the aim of simplifying the teaching of Java to first-year undergraduate students.

The ACM Java Task Force Libraries and API were produced by the Association of Computing Machinery's Java Task Force with the aim of simplifying the teaching of Java to first-year undergraduate students.

As observed here and here, it may be necessary to compile under Java 1.5 to avoid regressions seen with later versions of Java.

113 questions
42
votes
23 answers

Java Code for calculating Leap Year

I am following "The Art and Science of Java" book and it shows how to calculate a leap year. The book uses ACM Java Task Force's library. Here is the code the books uses: import acm.program.*; public class LeapYear extends ConsoleProgram { …
Ibn Saeed
  • 3,171
  • 11
  • 50
  • 59
8
votes
3 answers

Battleship game - ships overlapping

I'm writing a simple battleship game in Java using the ACM library. After the game starts, ships are supposed to be put on the canvas at random locations but the problem is that the ships might cover each other and this is not allowed in the game.…
Tsiskreli
  • 103
  • 1
  • 11
5
votes
4 answers

Java ACM package

I'm trying to write a java application in Eclipse. I'm really wanting to use the ACM.Program package, however, my copy of Eclipse doesn't have it installed! I've looked all over the net, and I can't find a single download for the ACM package. More…
Georges Oates Larsen
  • 6,812
  • 12
  • 51
  • 67
5
votes
2 answers

Caeasar Cipher with java's acm

The code below encrypts a word or sentence in the way Caesar did. You put the shift value and the program takes each letter of the word/sentence and "moves" in the alphabet acoording to the shift (key) value. But this is not the problem. I found the…
HpdsbuΖt
  • 103
  • 2
  • 2
  • 9
4
votes
1 answer

Cannot find symbol method addMouseListeners() in acm.program.GraphicsProgram

I've been working through The Art & Science of Java text and SEE CS106A course. Everything has been going smoothly until interactive graphics programs were introduced. The following code, taken directly from the text, will not compile: /* * File:…
Ryan Linton
  • 1,285
  • 1
  • 14
  • 20
3
votes
1 answer

Are the ACM Java Libraries used in real life?

Is the ACM JTF's Java libraries used in real life, or just prepared for students to make their study less complicated?
Eugene
  • 59,186
  • 91
  • 226
  • 333
3
votes
2 answers

Tic Tac Toe Computer Player (not AI)

I am a university student (1st year) and I have an assignment to make a Tic Tac Toe console game using the ACM Library. I managed to make it working Player VS Player. Another part of this assignment requires me to make it work like Player VS…
kostas7gr
  • 33
  • 5
3
votes
4 answers

How to handle window size for GraphicsProgram (ACM library)?

I want to define the size of the window, but I did not find a clean way to do it. SetSize() gives a strange result: public class Test extends GraphicsProgram { public void run() { setSize(400, 600); add(new GLabel("Width: " +…
A_rnO
  • 141
  • 1
  • 5
3
votes
2 answers

How can I add the ACM library in Ecplise?

I'm in an introductory CS class and Dr.Java has really limited functionality compared to Eclipse. How can I add the ACM.jar file for use in Eclipse?
ahtmatrix
  • 539
  • 1
  • 7
  • 19
2
votes
2 answers

Why is my label not centered along the y axis? (Stanford SEE CS106A)

I am trying to learn java using Stanford's online CS106A course. The course uses the acm library packages from http://jtf.acm.org/ Can anyone tell me why is my code below doesn't centered the label along the y axis? import acm.program.*; import…
user1296058
  • 173
  • 1
  • 12
2
votes
2 answers

How can I add shapes automatically in paintComponent?

As a beginner, whenever I want to add graphical shapes inside the frame I do something like this: public void paintComponent(Graphics g) { super.paintComponent(g); g.fillRect(0, 0, 10, 10); g.fillOval(10,10,10,10); } How do I draw an…
atmosphere506
  • 343
  • 3
  • 14
2
votes
2 answers

Eclipse cannot determine the main class

My code so far is: package graphics; import acm.graphics.*; import acm.program.*; public class project1 { public class graphics extends GraphicsProgram { private static final long serialVersionUID = 1L; public void run() { …
Neuromeda
  • 95
  • 1
  • 2
  • 7
2
votes
1 answer

Using Hex Codes for Colours in ACM Graphics API

I am writing a simple program using the ACM Graphics API, and am trying to use the setColor() method to set the color of a turtle. How do I have it use a hex code rather than a Color.COLOR mode because that does not have my color.
Calico
  • 57
  • 5
2
votes
1 answer

ACM Interactors Freeze

I'm trying to make a very simple program with Swing and ACM interactors. It is taken directly from a class handout, but does not function on my computer. When I run it, it functions fine for about half a second, then briefly flashes, reloads, and…
yohanstra
  • 23
  • 4
2
votes
1 answer

How to write my Java program with the ACM library (ConsoleProgram)?

I want ask a little question about my program. This is my code sample: public static void main(String[] args) { int q; int p; int thelargest; int thesmallest; Scanner input = new Scanner(System.in); System.out.println("Enter…
user2348367
1
2 3 4 5 6 7 8