/* BasicProgram.java * This is a "fill-in-the-blank" format for a basic Java program. Notice * that the 3 parts of the code inside the main() function are for input, * calculations and output. In a real program, you would replace this * introductory comment with a description of your program. */ import java.util.Scanner; // Tell compiler this program will read input. public class BasicProgram // Tell compiler the name of the program. { public static void main(String [] args) { // Step 1 -- Input: I've included the necessary declaration for // the input Scanner object, which means we will be reading // lines of input from the keyboard. But you also need to prompt // the user for data, and then read the data using functions like // sc.nextInt(). Scanners can do more than just read integers. For // more info, see: // http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html Scanner sc = new Scanner(System.in); // Step 2 -- Calcuations. Insert statements that perform the // essential calculations the program is supposed to do. // Step 3 -- Output. Write answer to the screen. Usually we'll // do this with: System.out.printf( whatever-you-need-to-print ) // Note that the "f" in printf means "formatted". printf is an // extremely useful function for printing output exactly how we want! } }