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
2
votes
2 answers

rotating in java

I have a simple question which I cannot find an answer for. In eclipse I have a simple GRect and GOval. How can I rotate them 90 degrees clockwise? I have tried move and movePolar but it doesn't have any effect. Here is the code: import…
regeme
  • 872
  • 6
  • 17
  • 30
2
votes
2 answers

How can I create rounded diagonal lines in Java using the ACM library?

I am trying to draw rounded diagonal lines in Java using the ACM library. A very complicated method would involve drawing a diagonal line, scaling it up to increase its width, drawing an arc on the top of that line with respect to the angles it is…
ahtmatrix
  • 539
  • 1
  • 7
  • 19
1
vote
1 answer

Changing the co-ordinate system in Acm(java)

I am trying to create a circle with co ordinate (0,0) at its center but I'm unable to shift the origin from top left corner to the center. Is there any way I can do this? Here's the picture showing the origin at top left but I want it in…
1
vote
2 answers

Why does getHeight() method not work in the constructor?

This is the code: import acm.program.*; public class test extends GraphicsProgram{ public test(){ println(getHeight()); } public void run(){ println(getHeight()); } …
1
vote
2 answers

Printing numbers 1-100, except when divisible by 5 or 12

The question is Write a Java program that prints numbers from 1 to 100. If the number is divisible by 5, instead of printing the number, your program should print how many fives are in this number, if the number is divisible by 12 it should print…
Fulgie
  • 11
  • 1
  • 3
1
vote
1 answer

Why is my output not as expected? Java ACM

For the following program I am expecting output as: 5 * 2^3 = 40 But the output is: 40 * 2^0 = 40 First I build a class "HandyInt": /** * An integer that provides arithmetic operations for great glory. */ public class HandyInt { /** The integer…
1
vote
0 answers

Centering a GObject in Java

since I am completely newly learning Java right now I have a serious problem which is hopefully easy to solve. I need to create the olympic rings for a course which should show up centered on the screen. Here's my code: import java.awt.Color; import…
Kate
  • 11
  • 2
1
vote
1 answer

What does 'd' stands for in - move(double dx, double dy)?

I am reading a java doc for GObject /acm.graphics. I am looking at this method: move(double dx, double dy) Moves the object on the screen using the displacements dx and dy. I am trying to understand what does the 'd' stands for and what is the…
Marcin Kulik
  • 845
  • 1
  • 12
  • 28
1
vote
0 answers

Newbie questions concerning CS106A, Eclipse, & ACM Libraries

After a while (5ish years) away from programming, I'm trying to follow along with Stanford's CS106A course but my inability to understand how Eclipse is halting my progress. I have looked on this site and elsewhere, but have only been partially…
ADW
  • 11
  • 2
1
vote
3 answers

acm.graphics library - Applet starts instead

I'm trying to use the ACM library, my source code looks like this. On running it the Applet is started, but the output is still in the console within Eclipse. It is supposed the app to be started in a standalone window, not in the console. What I'm…
Eugene
  • 59,186
  • 91
  • 226
  • 333
1
vote
0 answers

JAVA loop moving objects from bottom of applet to top of applet

I'm trying to have the lanes looping once they're moving over onto the top of the applet, to have them come out from the bottom of the applet back to the top and so on. I've tried using getBounds by setting an invisible GLine object at the top and…
Dmitriy
  • 97
  • 3
  • 15
1
vote
1 answer

Java do-while loop inside a method in its own class

I'm pretty new to java and we didn't really go over the methods but its required for the project. I am trying to place the whole two do-while loops into a method that I can call off within the public void run(). Could someone please guide me out how…
Dmitriy
  • 97
  • 3
  • 15
1
vote
2 answers

Java how to run program in a loop and keep counts

I created a quiz program that keeps track of students score. What I am trying to do is if the student received 100% then they get a message that their score is 100%. If the the score is less than 100 then the program should restart and keep the…
Dmitriy
  • 97
  • 3
  • 15
1
vote
3 answers

Java using for-loop to produce series of numbers

I am trying to write a collection of for-loops that produce the following series of numbers below. I am trying to accommodate my loops to print each series on the same line, with spaces between each term. I am new to java and got really confused on…
Dmitriy
  • 97
  • 3
  • 15
1
vote
0 answers

How do I make my GObject outline thicker?

I am trying to create a small circle and a big circle GOval Bubbles = new GOval(0, 0, 500, 500); Bubbles.setColor (Color.blue); Bubbles.setFilled (true); Bubbles.setFillColor (Color.blue); double x = Bubbles.getWidth()/2; double…
Cat Banana
  • 11
  • 2