I just started taking the Stanford CS106a course on iTunes, but I'm running in to problems with Eclipse. Here's my code:
/*
* File: Add2Integers.java
* -----------------------
* A simple ConsoleProgram to add two integers
* and display their total.
*/
import acm.program.*;
public class Add2Integers extends ConsoleProgram {
public void run() {
/* So all y'all in the back can see! */
setFont("DejaVuSerif-BOLD-24");
println("This program adds two numbers.");
int n1 = readInt("Enter n1: ");
int n2 = readInt("Enter n2: ");
int total = n1 + n2;
println("The total is " + total + ".");
}
}
When I try to run it, I get the message that the section does not contain an applet. I think it has to do with import acm.program
.
I downloaded the acm toolkit and tried adding the program.java
file to my root folder, building the path, doing the same for the entire acm folder, nothing works.
I just need help getting this simple program up and running so that I can start learning.
I'm running OSX 10.8.