CS 1713 Week 1: Getting Started

Objectives:

Activities

Reading: Chapters 1.4-1.5 and 2.1-2.6


Administrative:


Overview of the first two weeks of class

  1. Administrative details
  2. Create a simple Java project using eclipse
  3. Review for exam 1
  4. Exam 1

Getting Started

During the first week, we will be writing a simple program, learn how to use eclipse, and start reviewing CS 1063. In week 2, we will finish the review and have our first exam.

Start by making a directory under your Z drive:
Z:\working\java\cs1713-lectures


Case Study 1: HelloWorld - a program with simple output


Review of CS 1063: Part 1


We will cover the following case study as time permits.

Case Study 2: WhoAreYou - simple input

Create a new project, similar to HelloWorld, but this time have the computer prompt you for your name and then say hello to you. The project will be called cs02 and the class WhoAreYou should be in the package simpleinput.>

Sample output might be:
Hello, what is your name?
and then after you enter your name (George Bush):
Hello George Bush!

Here is the sample code:
package simpleinput;

import java.util.*;

public class WhoAreYou {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    System.out.println("Hello, what is your name?");
    String response = scan.nextLine();
    System.out.println("Hello "+response+"!");
  }
}