CS1150 (Fall 2012, Section 1): Programming Assignment 1

Basic Java


Objectives

Instructions

  1. Install DrJava from this link. Download the latest stable version and place the file that downloads in a safe place. This file is not an installer; it is the actual program. This makes it very portable and means that if you store it on e.g. a flash drive, you can run it from any computer.
  2. Run DrJava by double-clicking on the program and type the following code into the editor window:
    /* HelloWorld.java
     * Your name
     * CS1150.1206, Programming Assignment #1
     * This program prints some values to the screen
     */
    import java.util.Scanner;
    
    public class HelloWorld {
      public static void main(String[] args) {
        System.out.println("Hello, World!");
        System.out.println("This is the first Java program for");
        System.out.println("  CS1150.1206.");
        System.out.println("6 * 3 is " + 6 * 3);
        System.out.println("My name is YOUR NAME HERE.");
        System.out.println("What is yours?");
        
        Scanner keyboard = new Scanner(System.in);
        String name = keyboard.nextLine();
        System.out.println("Why, hello there, " + name);
      }
    }
    
  3. Save the file as HelloWorld.java and compile and run the program.

Deliverables

Zip up only the file HelloWorld.java, name the resulting zip file cs1150.1208-1-yourlastname-yourfirstname-pa1.zip, and email this file to bparks AT uccs DOT edu with a subject of CS1150.1208-001 PA1.